Cheap Web SEO

July 9, 2010

Php SEO Friendly Urls

Filed under: SEO — Tags: , , , , , — admin @ 11:29 AM

SEO Friendly Urls.jpg" alt="Php SEO Friendly Urls" border="0" align="left" />
How do I mod rewrite this link to make it a static url?

I have a site that I am trying to make SEO friendly. Using .htaccess, I want to create a mod_rewrite variable so that my product page urls like are dynamically created like this: www.site.com/details.php?prod=abcd1234 become static pages like this: www.site.com/abcd1234.php instead. I also need help writing the 301 redirect variable for the example above as well.

Help would be greatly appreciated, thanks!

Oh, and yes the server does have mod rewrite enabled through apache.
I didn’t realize yahoo would alter my example link, but it should read prod=abcd1234, not prod=….

All you have to do in order to rewrite links is to create a .htaccess file in the root folder of your site with this content:

Options +FollowSymLinks

RewriteEngine on
RewriteRule ^([0-9]+)(/)?$ /details.php?prod=$1 [L]

This is the script that will achieve what you asked for and the example is based on my site’s rewrite engine: http://x.excessiveplus.net

As you can see, Apache uses regular expressions, which will easen your work a lot. To learn more about the RegEx, check out this link: http://www.regular-expressions.info/

Good luck!

Create Remember Me Login using PHP and Dreamweaver


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress