...

View Full Version : String Replace



Erindesign
03-09-2007, 01:02 AM
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.

Inigoesdr
03-09-2007, 01:09 AM
str_replace() (http://www.php.net/str_replace) or urldecode() (http://www.php.net/manual/en/function.urldecode.php)

karlosio
03-09-2007, 01:04 PM
<?php
$foo= "coding forums";
$foo_rep = str_replace(" ","_",$foo);

echo $foo_rep;
?>

aedrin
03-09-2007, 04:27 PM
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).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum