我正在使用.htaccess将网址从http://
转换为https://
。
如何在.htaccess文件中添加例外,以便在访问特定文件夹时不转换路径? 例如" / nohttps /" -folder
我想要发生的事情:
http://example.com --> https://example.com
http://example.com/something/ --> https://example.com/shomething/
http://example.com/nohttps/ --> http://example.com/nohttps/ ("no rewrite")
.htaccess文件现在:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
答案 0 :(得分:1)
您可以使用RewriteCond
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/nohttps
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}