mod_rewrite, modern delight.
January 12, 2008 4:50 PM   Subscribe

I'm moving a website from one host to another and adding a level to the directory structure. How can I do this with mod_rewrite?

Site v.1 is hosted at one provider, and, in advance of rolling out v.2, we're switching hosts as well. To avoid DNS propagation issues, we're moving the new site to http://domain-at-newhost/v1/ where it should live until v.2 is launched.

I think I should be able to use mod_rewrite in a .htaccess file to rewrite requests for http://domain-at-newhost/directory/file.html to http://domain-at-newhost/v1/directory/file.html, but can't get it to work for nested directories. Anybody?
posted by piro to Computers & Internet (2 answers total)
 
Try this ...

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/v1
RewriteRule ^(.*) /v1/$1 [R]
posted by devbrain at 6:20 PM on January 12, 2008


(that's the httpd.conf format - for .htaccess you probably need to omit the / before the /v1 in the second line)
posted by devbrain at 6:21 PM on January 12, 2008


« Older Family Budget Decision-making   |   Tascam USB box vs. Martin D-16 Newer »
This thread is closed to new comments.