Looking for the best site migration strategy for SEO, which consider these specific combinations of elements and challenges:

*note: site is in Wordpress.

Htaccess redirect code to go from sub domain of old domain to root of new domain?


HTTP://subDomain.OldDomain.example/article to HTTPS://newDomain.example/article and HTTPS://subDomain.OldDomain.example/article to HTTPS://newDomain.example/article

Considerations & Code Required:

*Some pages will be a completely new URL structure but same content, how to keep that in tact SEO wise, or must that be redirected individually?


HTTPS://subDomain.OldDomain.example/?=01/article to HTTPS://newDomain.example/article

*For some sub domains on the old domain, an existing redirection is already in place from HTTP to HTTPS. The HTTP version has had a lot of "SEO juice"/strength for years, whereas as the redirection to HTTPS has been only about a month or less.

Therefore for SEO strength, is it more beneficial to have a redirect chain of:

HTTP://oldDomain.example > HTTPS://oldDomain.example > HTTPS://newDomain.example

OR two separate redirects:

HTTP://oldDomain.example > HTTPS://newDomain.example


HTTPS://oldDomain.example > HTTPS://newDomain.example

  • How many URLs have a "completely new URL structure"? Although your example appears to show a pattern ("article" to "article" - or is the target "article" different?). The important point is how many new URLs have no relation to the source URL - ie. no pattern. Do you have access to the server config? Is the olddomain (and subdomains) pointing to a different host? Or will all domains be pointing to the same WordPress install?
    – MrWhite
    Oct 16, 2018 at 11:39
  • a) Well to be very specific, I'm having a dev migrate 5000+ database content/'questions' from a PHP Q&A platform to a Q&A Wordpress plugin. So 5000+ new URL's - not sure how URL will play out but probably dynamic URL's to text-strings structure? b) The target article will be exact content, similar key words. c) I'm a beginner w/servers, so not sure on 'config', but I have dedicated hosting root access I believe, and access to htaccess file. php settings, cpanel etc. (continued....)
    – JJ100
    Oct 19, 2018 at 2:02
  • d) I have the Q&A PHP Platform ("answers") on the old sub domain and on another old sub domain ("news") is Wordpress. The WP sub domain needs to be redirected as home page of the new domain, and the Q&A PHP sub domain needs to be redirected to 'newDomain/answers'
    – JJ100
    Oct 19, 2018 at 2:03

1 Answer 1


Without knowing precisely what combination of URLS, and what specific patterns, and what exceptions, these are some ideas you can try.

There should be no affect on your Pagerank if you permanently and correctly redirect links to https:

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

If there is a pattern, or group of patterns, to the redirects then you can construct htaccess conditions to redirect all of one subdomain to the new format URL.

Such as a redirect of the subdomain to the root

RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$
RewriteRule ^ http://example.com/$1 [L,R]

or a subfolder

RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$
RewriteRule ^ http://example.com/subfolder/$1 [L,R]

If you have a few exceptions to the rules you can add individual htaccess rules which precede your rewrite conditions which end with [L, R] so the processing stops.

To remove characters such a ?=01 from your other URL precede the above with a rewrite rules such as:

RewriteRule ^([^/]+)/?=01/?(.*)$ /$1/$2 [R]

For new pages with entirely different URLs you could create a rewriterule specifically for them and put them in first position right after RewriteEngine on or RewriteBase line with a [L] tage so they complete and end, such as:

Redirect permanent http://subdomain.olddomain.com/oldcategory/oldfile/ https://newdomain.com/newcat/newfilename.html [R,NC,L]

Prior to this move you should have both http and https versions of your domain (and www. if you were using that as well) setup in Google Search Console so that you can track the migration. And once you have completed the migration use the GSC Change of Address tool - follow these instructions


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.