Reputation: 37
I work on a Wordpress Network. Let's say that the main site has the link www.main-site-old.com, and all the other sites in this network have links like www.main-site-old.com/site1 , www.main-site-old.com/site2 e.t.c.
I want to redirect ONLY the main site to a new domain (let's say www.main-site-new.com) and let all the others stay as they are.
I tried this one:
Redirect 301 / http://www.main-site-new.com/
but it redirects the whole domain (for example it redirects www.main-site-old.com/site1 to www.main-site-new.com/site1)
I also tried:
RewriteCond %{REQUEST_URI} !=/site1
RewriteRule ^.*$ http://main-site-new.com/$0 [R=301,L]
but nothing happened.
Upvotes: 2
Views: 63
Reputation: 4302
With mod_alias
redirect
you will not be able to use regex
to capture a request for http://www.main-site-old.com
only so, you could use another one RedirectMatch
like this :
RedirectMatch 301 ^/?$ http://www.main-site-new.com
Or go to mod_rewrite
by this :
RewriteEngine On
RewriteRule ^/?$ http://www.main-site-new.com [R=301,L]
Note: clear browser cache then test.
Upvotes: 1