0

So I inherited a multisite instance and I've changed the domain from example.co to example.com.

A 302 redirect that takes you from the old domain to the new domain was automatically created. This is fine on paper, but the problems are:

  1. I need it to be a 301 redirect for SEO purposes
  2. The redirect strips away URL paths, so mydomain.co/path takes you to mydomain.com

Trying to override the redirect with something like the code below creates a redirect loop.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.co [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.co [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301,NC]

I want to find this redirect so I can modify it. So far I've:

  1. Deleted my browser cache with every test
  2. Changed my .htaccess to the vanilla Wordpress file. Breaking the file breaks my site, so I know it's working
  3. Disabled all the plugins even by renaming the plugins folder
  4. Checked my php files for redirects
  5. Reverted to the old domain. This stopped the redirection. Interestingly, it kept redirecting from http to https. What could be handling this?

This is my current .htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [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|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

Where else could the redirect be located? I'm sure I'm overlooking something obvious. Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.