我正在尝试将特定网址重定向到https以及http
上的所有其他网址但不能正常工作。
http
到https
条件工作正常,但http
部分的https网址不能正常工作
我读了多个答案而不是多个[OR]
条件!^(login|brandcontroller|...)
已将https应用于http但未正常工作
#HTTPS:// --> to --> HTTP:// (all url except https urls)
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(login|brandcontroller|admin|archives|lightboxs|enquiries|uploaders|brandarchives|content) [NC]
RewriteRule . http://%{SERVER_NAME}%{REQUEST_URI} [L]
#HTTP:// --> to --> HTTPS:// (specific urls)
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^(login|brandcontroller|admin|archives|lightboxs|enquiries|uploaders|brandarchives|content) [NC]
RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [L]
任何人都可以帮助htaccess重定向
答案 0 :(得分:0)
我找到了在htaccess文件中设置!=
{{REQUEST_URI}}
的方法
RewriteCond %{HTTPS} off
# force https for all required URLs
RewriteCond %{REQUEST_URI} ^(?:login\/signin|forgot|brandcontroller|admin)
RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# do not do anything for already existing files
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
# force http for all other URLs
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^(?:login\/signin|forgot|brandcontroller|admin)
RewriteRule .* http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]