Sunday, April 24, 2011

htaccess SEO

I'm going to show you some good htaccess SEO tricks in this post.
If you really want to get some good Page Rank then all the crawl errors that you see in te Google Webmaster Tools should be corrected.
Most of these errors are 404 (Not found) errors, meaning that there are link to pages in your site that doesn't exist anymore, maybe because the url changed or they were deleted.

With these htaccess SEO tricks you can easily correct some errors and improve SEO on your website

  1. # Eliminate the /folder-name from directory from url
      RedirectMatch 301 /folder-name/ http://www.my-site.com/
     
  2. # Rename the /old-name directory to new-name
      RewriteRule ^old-name/(.*)$ /new-name/$1 [R=301,L]

  3. Feedburner redirect
    RewriteCond %{HTTP_USER_AGENT} !FeedBurner.*
    RewriteRule ^rss.xml$ http://feeds.feedburner.com/MySite [R=temp,L]

  4. Setting preferred domain with starting with www
    RewriteCond %{HTTP_HOST} ^
    mydomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.
    mydomain.com/$1 [L,R=301]

  5. Redirect to new domain
    RewriteCond
    %{HTTP_HOST} ^([^.:]+\.)*oldwebsite\.com\.?(:[0-9]*)?$ [NC]
    RewriteRule
    ^/(.*)$ http://www.mynewwebsite.com/$1 [R=301,L]
     
  6. Redirect one single page (with no extension):
    RewriteRule ^my-old-page$ http://www.mysite.com/my-new-page [R=301,L]
  7. Url rewriting: Rewriting yoursite.com/article.php?article_id=abc to yoursite.com/abc
    RewriteRule ^([a-zA-Z0-9_-]+)$ article.php?n=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$ article.php?n=$1


    (Don't forget to make a backup of your old htaccess file fisrt, just in case)

0 comments:

Post a Comment

Your opinion is very appreciated, thank you!