The Apache module mod_rewrite provides a powerful mechanism for hiding, redirecting, and reformatting request URLs. I just finished implementing a mod_rewrite scheme for timfanelli.com to accomplish 3 things:
1. Redirect old URLs with a 301 redirect code
2. Hide certain parts of the URL from my readers.
3. Optimize my Google pagerank.
Using a two simple rewrite rule
RewriteEngine on
RewriteRule ^/index.cgi(.*) /old.html [R=301]
To hide the /cgi-bin/blog.cgi portion of my URL.
RewriteRule ^/blog/(.*)$ /cgi-bin/blog.cgi/ [PT]
RewriteRule ^/$ /blog/ [R=301]
RewriteRule ^/blog$ /blog/ [R=301]
To redirect to domain name to www.domain.name
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule .* http://www.yourdomain.com [QSA]
Sunday, May 18, 2008
Subscribe to:
Post Comments (Atom)
1 comments:
Hey thanks for this amazing post! Thank you so much for sharing the good post, I appreciate your hard work.Keep blogging.
DevOps Training in Electronic City
Post a Comment