Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-09-2007, 01:02 AM   PM User | #1
Erindesign
Regular Coder

 
Join Date: Apr 2006
Posts: 231
Thanks: 9
Thanked 1 Time in 1 Post
Erindesign is an unknown quantity at this point
String Replace

Hey All,

I'm having some URL/SEO Issues. I have a video website, and for the sake of SEO, I put ?video=blah instead of ?videoid=##. Now, the spaces are replaced with %20. This is really bad when it comes to SEO. A user will probably not click something that has a bunch of %20s and such when they see it on an seo.

Now, Is there a php way of replacing certain letters in a string?

I got: $foo="Coding Forums";
I want: $foo="Coding_Forums";

*Note, I don't make urls, they are automatically generated off of the mysql.
Erindesign is offline   Reply With Quote
Old 03-09-2007, 01:09 AM   PM User | #2
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
str_replace() or urldecode()
Inigoesdr is offline   Reply With Quote
Old 03-09-2007, 01:04 PM   PM User | #3
karlosio
Regular Coder

 
Join Date: Dec 2006
Location: In the wilderness
Posts: 106
Thanks: 9
Thanked 5 Times in 5 Posts
karlosio is an unknown quantity at this point
PHP Code:
<?php
$foo
"coding forums";
$foo_rep str_replace(" ","_",$foo);

echo 
$foo_rep;
?>
__________________
"The advantage of computers is that they do exactly what you tell them to do. The disadvantage of computers, on the other hand, is that they do exactly what you tell them to do."

Excellent resource for learning PHP here
karlosio is offline   Reply With Quote
Old 03-09-2007, 04:27 PM   PM User | #4
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
Quote:
This is really bad when it comes to SEO. A user will probably not click something that has a bunch of %20s and such when they see it on an seo.
SEO stands for Search Engine Optimization. All you're doing is making it more likely that a search engine will pick you for their results. By adding the keywords in the URL, etc. The spaces aren't going to matter. And people hardly look at more than the first parts of a URL (the domain name).
aedrin is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:18 PM.


Advertisement
Log in to turn off these ads.