Reputation: 73
I have googled for an hour about this, but none of the alternates are working for me. My goal:
301 Redirect from http://www.domain.com/guides/men/ to https://www.domain.com/guides/men/
I have tried both of these solutions suggested on other pages and neither worked. I keep seeing the http version of the page in both cases:
http://stackoverflow.com/questions/4762859/htaccess-redirect-subfolder-to-https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(guides/men/.*)$ https://www.example.com/$1 [R=301,L]
http://stackoverflow.com/questions/9642877/redirect-only-one-folder-to-https-all-others-to-http
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} secure
RewriteRule ^(.*)$ https://www.example.com/guides/men/$1 [R=301,L]
At this point Im wondering if its my syntax, or placement within (a very large htaccess file - nearly 2,300 lines of redirects due to a recent major site migration). I was putting it at the bottom of the file.
Upvotes: 3
Views: 405
Reputation: 5846
This should work.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(guides/men/.*)$ https://www.domain.com/$1 [R=301,L]
Upvotes: 2