I’ve got a multisite sub-domain install with 3 sites on it. 2 of the sites use domain mapping.

The main site (id=1) requires several 301’s that are old pages from a previous structure such as:

Redirect 301 /about/careers/ /contact/careers/

One of the other sites (id=3) has content that has moved into the main site. Normally, I’d redirect this in the .htaccess of that site:

Redirect 301 /news/events/ http://domain.com/news/events/

Multisite only has one .htaccess file. Is there a way to add 301 redirects for each individual site/domain from the main .htaccess file?

3 Answers
3

Okay,

RewriteEngine On
RewriteBase /

# Blog ID1 Rewrite Rules
RewriteCond %{HTTP_HOST} ^(www\.)?primary-domain.co.uk [NC]
RewriteRule ^about/careers/$ contact/careers/ [R=301,NC,L]
RewriteRule ^glossary.html$ sitemap/ [R=301,NC,L]

# Blog ID3 Rewrite Rules
RewriteCond %{HTTP_HOST} ^(www\.)?mapped-domain3.co.uk [NC]
RewriteRule ^about/$ http://primary-domain.co.uk/about/ [R=301,NC,L]
RewriteRule ^news/$ http://primary-domain.co.uk/news/ [R=301,NC,L]

This works, there’s 158 more lines to my particular site but you get the idea. I hadn’t found a clear solution to this but this article helped me massively.

Hope this helps anyone else looking for the same solution 😉

Leave a Reply

Your email address will not be published. Required fields are marked *