Why aren’t any of these 301 redirects working?

I have a WordPress multisite and I’m trying to direct everything from one of the sites to a completely different domain. Of the examples I’ve tried below, none of the redirects seem to do anything.

Options +FollowSymlinks
RewriteEngine on

#attempt one
Redirect 301 ^/multisite-one/.*$ http://newdomain.com/

#attempt two
RewriteRule ^multisite-one/$ http://newdomain.com/ [L,R=301]

#attempt three
RewriteCond %{REQUEST_URI} ^/multisite-one/(.*)$
RewriteRule ^(.*) http://newdomain.com/%1 [R=301,NC]

#attempt four
RewriteCond %{HTTP_HOST} ^multisite-one/$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/ [R=301,L]

#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

#END WordPress

A little bit about my setup:

Read More
  • The multi site is set up as having 2 homepages, one for multisite-one, another for multisite-two. There is no top level index page.
  • The multisites share page templates. The two sites are structured the same, they just contain different content (i.e. multisite-one is customer service, multisite-two is how-tos)

What I’m looking to accomplish:

http://mainsite.com/multisite-one/ redirects to http://newdomain.com/
http://mainsite.com/multisite-one/page2 redirects to http://newdomain.com/ 
http://mainsite.com/multisite-one/page8/pies redirects to http://newdomain.com/

http://mainsite.com/multisite-two/ does not redirect
http://mainsite.com/multisite-two/page2 does not redirect
http://mainsite.com/multisite-two/page8/tacos does not redirect

I’ve tried adding the above redirects within the WordPress code as stated in this similar question. I’ve also tried all of these that seem relevant.

Note: I cannot use plugins because they are currently disabled and I do not have FTP access. I have to make these updates using the linux command line. Obviously this is a terrible situation.

Related posts

2 comments

  1. There are lots of plugins you could use to help although i prefer to do it myself. I personally use:

    Redirect 301  /subsite/  http://newdomain.com/
    

    That works for me moving anything in the subsite folder to the newdomain address but preserving the rest of the URL.

    If you want everything in subsite to move to http://newdomain.com/ and lose everything after that in the url then your second one should work

Comments are closed.