[thelist] Restructuring and HTTP 301 (was: another google question)

Bruce Wilbur thelist at brucew.com
Sat Feb 8 12:11:00 CST 2003

Dennis R wrote:
> This strikes me as a candidate for HTTP 301 Moved Permanently [0], and
> Google says its spider understands this [1].

Indeed it does, and it updates the listings with the new URI fairly quickly.  So do FAST, Scooter and Slurp.

> My question is: what are the arguments for and against sending HTTP 301,
> other than needing a redirect for every page (which could likely be handled
> in some manner with a script)?

I don't know how to do it with IIS, but here's an example from a .htaccess file I drop into a directory to redirect everything to a new subdomain.

Lines starting with # are comments.  If you have access to httpd.conf, it's better (read: faster and less taxing on the server) to put this there instead of .htaccess, remembering to add specific subdirectory names as required at the start of the rule, or you'll redirect the entire site.

And of course, mod_rewrite needs to be part of your Apache installation.  I've not come across a case where it isn't, but YMMV.


# Turn on the Apache URI Rewriter
RewriteEngine On

# Redirect everything that ends with .html to new subdomain
# with original root filename but with .shtml extension (used in
# case of a bookmark to an old, pre-SSI version of the page.)
# (if this were DOS, the same as changing *.html to *.shtml)
RewriteRule ^([a-zA-Z0-9_]+).html http://subdomain.mydomain.com/$1.shtml

#Same thing for shtml to shtml
RewriteRule ^([a-zA-Z0-9_]+).shtml http://subdomain.mydomain.com/$1.shtml

# Catch any leftovers and send them to index page.
# [L] indicates this is the last rule.
RewriteRule ^$ http://subdomain.mydomain.com/ [L]


And there you have it.  Four lines.  Works for me--and more importantly, for my clients--with *zero* adverse effects on rankings or listings.  Much faster and cleaner-looking too than the methods described earlier in the thread.

BTW, this is everything I know either regular expressions or mod_rewrite.  Still learning myself.


More information about the thelist mailing list