Rewriting your URL’s for SEO
This example is only good for apache
1). You must have the module: mod_rewrite installed on apache
2). You need to use a .htaccess file to build the functions, if you don’t have one don’t worry. Just create a text file with this content and upload it.
First line, turn on the engine
RewriteEngine on
Second line, tell the engine where it needs to work
RewriteBase /
Now you can specify your re-writes, here are 3 examples.
1). Your URL looks like this? http://www.mysite.com/index.php?page=privacy <- This suck for SEO right?
So your rewrite rule would be,
RewriteRule ^privacy.html$ index.php?page=privacy
Now you can change your anchor link to http://www.mysite.com/privacy.html
2). If your URL looks this? http://www.mysite.com/index.php?page=story&storyid=66 Wow this really sucks for SEO!
This re-write is a little more complicated, you need to match the numbers.
RewriteRule ^story([^/]+).htm$ index.php?page=showstory&storyid=$1
Now you can point your links to http://www.mysite.com/story66.htm This will really help!
3). If your URL looks like this? http://www.mysite.com/user.php?username=myuserid This can be very difficult, because now you have a possibility of non Alpha Numeric lettering. So we need a string that can handle all of them.
RewriteRule ^([a-zA-Z0-9_-]+)$ showprofile.php?username=$1 [QSA,L]
Now you can point your links to http://www.mysite.com/myuserid
Personally I like usernames, not to have an extension on them for easy tracking. But you can easily add a .htm to the end by just changing it to.
RewriteRule ^([a-zA-Z0-9_-]+).htm$ showprofile.php?username=$1 [QSA,L]
Now I cannot easily tell you how to fix your links in your code, since every site is a little different but give it a shot. You can always post questions here in the comments section of this post.
Labels: seo, url rewrite




0 Comments:
Post a Comment
<< Home