How to keep old 301's working when doing the http to https switch?

I need advice on altering my htaccess file for an upcoming http to https upgrade. Can you help? See the examples below.

Our site is old, and therefore has a lot of “SEO” 301 redirects just to keep our incoming links valid (it used to be a lot easier to get links, so we want to keep these old links). Below is a sample from our CURRENT htaccess file…

#CURRENT http SAMPLE

RewriteOptions inherit
RewriteEngine on

#301 rules for umbrella clothesline pages (salvages SEO value of links to old deleted HTTP pages)
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^outdoor_umbrella_clotheslines\.html$ "http\:\/\/www\.example\.com\/umbrella\-clotheslines\.html" [R=301,L]
RewriteRule ^outdoor_umbrella_clotheslines_details\.html$ "http\:\/\/www\.example\.com\/umbrella\-clotheslines\.html" [R=301,L]
RewriteRule ^rope\-replacement\.html$ "http\:\/\/www\.example\.com\/umbrella\-clotheslines\.html" [R=301,L]

# Change all remaining requests to the www version
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [L,R=301,NE]

What I need advice on is doing valid 301 redirects to the new HTTPS version of the site. It appears that the following is correct, but I am not sure about the order the commands should be in.
(see more questions after this proposed example) ((we always use the www version of our site))

#Proposed HTTPS example

RewriteOptions inherit
RewriteEngine on

#301 rules for umbrella clothesline pages (salvages SEO value of links to old deleted HTTP pages)
# removed the L from the 301 brackets so process continues down to the final https switch
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^outdoor_umbrella_clotheslines\.html$ "http\:\/\/www\.example\.com\/umbrella\-clotheslines\.html" [R=301]
RewriteRule ^outdoor_umbrella_clotheslines_details\.html$ "http\:\/\/www\.example\.com\/umbrella\-clotheslines\.html" [R=301]
RewriteRule ^rope\-replacement\.html$ "http\:\/\/www\.example\.com\/umbrella\-clotheslines\.html" [R=301]

# Change all remaining requests to the www version
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [R=301,NE]

#converts all http URLs from both current pages and the above salvaged pages to HTTPS format
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Is this method and order valid?

Does it do what we need (permanently redirecting both current good pages and old salvaged pages over to HTTPS) ??

Any help you can provide is appreciated.

Thank you,

Greg

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.