Hi all,
Our website has undergone both a redesign (with new URLs) and a migration to HTTPS in recent years. I'm having difficulties ensuring all URLs redirect to the correct version all the while preventing redirect chains. Right now everything is redirecting to the correct version but it usually takes up to two redirects to make this happen. See below for an example. How do I go about addressing this, or is this not even something I should concern myself with?
Redirects (2)
<colgroup><col width="123"><col width="302"></colgroup>
|
Redirect Type
|
URL
|
| |
http://www.theyoungfirm.com/blog/2009/index.html
301
|
https://theyoungfirm.com/blog/2009/index.html
301
|
https://theyoungfirm.com/blog/
|
This code below was what we added to our htaccess file. Prior to adding this, the various subdomain versions (www, non-www, http, etc.) were not redirecting properly. But ever since we added it, it's now created these additional URLs (see bolded URL above) as a middle step before resolving to the correct URL.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Your feedback is much appreciated. Thanks in advance for your help.
Sincerely, Bethany