Answer the question
In order to leave comments, you need to log in
How to redirect from http to https for a specific folder?
I have a site in php. The site has a lot of directories - folders and just php files. How to make the whole site redirect to https, but only except for one goods folder and all the files and folders attached to it?
I tried that, but it still redirects to https
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteCond %{HTTP_HOST} ^goods [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_FILENAME} goods/ [NC]
RewriteRule ^([^/]+) $1 [L]
RewriteCond %{HTTP_HOST} ^site\.ru
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question