Reputation: 3318
I'm trying to use .htaccess to redirect: http://shop.mysite.com/products/product-1 to https://shop.mysite.com/products/product-1 using .htaccess. The only difference is the last part of the URL, the product name. I only want the redirect to be in affect for the products pages, nothing else.
Any tips?
Upvotes: 0
Views: 872
Reputation: 143966
Try adding these rules to the htaccess file in your document root:
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP_HOST} ^shop\.mysite\.com$ [NC]
RewriteRule ^/?products/(.*)$ https://%{HTTP_HOST}/products/$1 [L,R=301]
Upvotes: 2