I’ve a multisite web site with 5 domains in WordPress which makes use of WordPress MU Area Mapping plugin.
I wish to redirect each subpage to new area, however we will probably be nonetheless utilizing the homepage, as a result of it comprises some hyperlinks within it, so root, wp-admin
and wp-login
, needs to be nonetheless accessible and never redirected. The best way to set this up in .htaccess
so WordPress will nonetheless operate?
instance of a website:
oldone.com/ --> no redirection
oldone.com/wp-admin --> no redirection
oldone.com/wp-login --> no redirection
oldone.com/about --> newone.com/about
oldone1.com/about --> newone1.com/about
... and so on ...
.htaccess
:
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# uploaded information
RewriteRule ^([_0-9a-zA-Z-]+/)?information/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content material|admin|contains).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]
RewriteRule . index.php [L]
### oldone.com redirect
RewriteCond %{HTTP_HOST} ^oldone.com$ [NC]
#redirects area.com to www.oldone.com
RewriteRule ^(.*)$ http://oldone.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.oldone.com.com$ [NC]
RewriteCond %{REQUEST_URI} !^/(wp-login/?|$)
RewriteCond %{REQUEST_URI} !^/(wp-admin/?|$)
RewriteRule ^(.*)$ http://newone.com/$1 [R=301,L]
####