views:

131

answers:

2

I'm moving my site to a new host but I need to have my current server continue to handle requests (not all files can be moved to the new server). So I added a parked domain to my old server (old.mydomain.com) and I want all requests to it to be written to the files from the old site.

My old site (mydomain.com) was hosted internally in a folder (/public_html/mydomain/) and I want all requests to old.mydomain.com to be rewritten to the same folder. So if mydomain.com/blog was internally at /public_html/mydomain/blog I now want old.mydomain.com/blog also to reach /public_html/mydomain/blog.

Here is the .htaccess that I'm trying to use:

RewriteCond %{HTTP_HOST} ^old\.mydomain\.com/*
RewriteRule ^(.*)$ mydomain/$1 [NC,L] 

but for some reason as soon as I add the $1 in the rewrite rule I get an internal error.

Any ideas?

A: 

Configure this as a separate vhost called old.mydomain.com and ensure it comes before *.mydomain.com in your vhost definitions (i.e. higher in vhosts.conf). Give old.mydomain.com the same DocumentRoot as your previous domain had.

.htaccess is the most processor intensive way to serve a webpage, and should only be used there are no other options available.

Andy
I'm on a shared host so I don't have access to vhosts.conf
Guy
A: 

Please try to fix your .htaccess config as follows:

RewriteCond %{HTTP_HOST} ^old\.mydomain\.com$
RewriteRule ^(.*)$ /public_html/mydomain/$1 [NC,L]
TonyCool
I tried that, still get an internal error :(
Guy