ArtcoInc Posted July 10, 2015 Share Posted July 10, 2015 A couple of questions about my .htaccess file: I have just added a SSL certificate to my site. And, the SSL certificate is issued for www.<mysite>.com (note the www.). So, I now have 3 redirects in the .htaccess file:1) If the customer does not include the www. in the URL, add it.2) If the customer does not include the https://, add it3) Since the store is in the /catalog sub-directory, if the customer doesn't specify the sub-directory, add it.So, if the user types <mysite>.com, they will be redirected to https://www.<mysite>.com/catalog The relevant part of my .htaccess file looks like this: RewriteEngine on #First rewrite any request to the wrong domain to use the correct one (here www.) RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] #Then, rewrite to /catalog RewriteCond %{REQUEST_URI} !^/catalog [NC] RewriteRule ^(.*)$ /catalog/$1 [L] #Now, rewrite to HTTPS: RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 1) Is there a preferred sequence for this?2) A couple of the website performance testing sites are complaining about the 3 redirects. Can this be reduced down to 1 or 2?3) I think Google said that these types of redirect should be a 302, not a 301.Thoughts? Comments? Insults? B) Thanks! Malcolm Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.