Craig Craig - 1 year ago 51
Apache Configuration Question

htaccess - Redirecting all traffic to another domain except existing 301's

My htaccess file is filled with 301 redirects like such:

Redirect 301 /old-page.html

There are about 100 of these redirects. What I would like to do is redirect all traffic going to the old site to go to the new site excluding the existing 301's

So if someone goes to
it will take them to
and if someone goes to
it will take them to
- just the home page.

Is it possible to do this using mod_rewrite and mod_alias without rewriting the current 301's?

Answer Source

You can keep all your 301 rules. Just insert this generic 301 rule below your existing rule:

# all existing 301 rules go here

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)?old-site\.com$ [NC]
RewriteRule ^ [L,R=301]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download