Thursday, November 30, 2006

mod_rewrite in Apache gives you some really powerful ways to Rewrite URLs.

From this page I found:


RewriteEngine On
RewriteRule /.* http://www.new-domain.com/ [R]


Which will redirect any page request from your old site to the homepage of your new site.

If you change it to:

RewriteEngine On
RewriteRule /(.*) http://www.yoursite.com/$1


It will even redirect full URLs to your new site. Those are regexps up there, the first one "(.*)" matches all URLs from your old site and $1 inserts whatever was found in that first "(.*)" match.