Remove SSL integration from a specific folder usin

2019-04-08 02:25发布

I have an integrated SSL for my entire site and have placed htaccess code to redirect to https when anyone visits my domain URL. But I want to keep one folder out of this redirection to https. Please help me with this... Below is the htaccess code placed in my root to redirect all requests to https counterpart

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Thanks

标签: .htaccess ssl
1条回答
时光不老,我们不散
2楼-- · 2019-04-08 02:47

Just add a condition to exclude the folder:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/folder1
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

And if you wanted to redirect SSL requests to non-SSL for /folder1, then:

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/folder1
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
查看更多
登录 后发表回答