Reputation: 1
Trying to setup .htaccess and mod_rewrite to switch to a new domain.
Currently using (from old domain):
RewriteEngine On RewriteRule ^(.*)$ [domain.com] [R=301,L]
so.. olddomain.com/abc -- domain.com/abc
However, I would like one more feature, but can't seem to get it working. I want every file in the old site to redirect to the new site unless someone visits www.olddomain.com, then i want it to show the olddomain.com/index.php file.
Upvotes: 0
Views: 190
Reputation: 17388
Have you tried catching that with a no-redirect rule before your rewrite? (I'm not sure whether that regexp needs to be ^$ or ^/$)
RewriteRule ^$ - [L]
RewriteRule ^(.*)$ [domain.com] [R=301,L]
Upvotes: 0