.htaccess htaccess使用http://or重写全部http://www. 除了一个或两个URI之外,都可以使用https
我目前使用的是:.htaccess htaccess使用http://or重写全部http://www. 除了一个或两个URI之外,都可以使用https,.htaccess,http,mod-rewrite,https,.htaccess,Http,Mod Rewrite,Https,我目前使用的是: RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https:/
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [AND]
RewriteCond %{REQUEST_URI} !\/folder/next_folder/(custom_id)
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
我真正想要的是:
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [AND]
RewriteCond %{REQUEST_URI} !\/folder/next_folder/(custom_id)
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
正如您所看到的,我试图在重写到https之前添加一个额外的条件。
对于所有页面,我都使用了https,但现在firefox有一个更新,并给出了混合内容的问题(当加载使用http://而不是https://的iframe时):
这就是为什么我需要从使用https://中排除一些页面。注意,我也删除了www.too
我尝试了不同的方法,但仍然会出现错误,或者根本无法正常工作。非常感谢您的帮助。将重写条件移动到
http:
已启用的部分,而不是https:
已启用的部分
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/folder/next_folder/custom_id
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
这就成功了。我变了-继续=off和https到http,因此他们被迫通过http查看(更适合我)。我还添加了另一个条件,在第一个条件下添加了[或]。现在一切都正常了。非常感谢您的帮助。@RensTillmann很高兴您能按您想要的方式工作!:)