我已经使用htaccess强制所有页面使用...
重新路由到httpsRewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://ourdomain.com/$1 [R,L]
我有什么方法可以为mydomain.com/videos&& ourdomain.com/blog确保这些页面被强制删除https并使用http?
答案 0 :(得分:6)
您已经使用RewriteCond
来限制重写到端口80上的请求。
您不想要在{80}的/videos
和/blog
上重写请求,所以:
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/videos
RewriteCond %{REQUEST_URI} !^/blog
RewriteRule ^(.*)$ https://ourdomain.com/$1 [R,L]
你想在端口上重写这些URL的请求(大概)443:
RewriteCond %{SERVER_PORT} 443
RewriteRule ^/((videos|blog)/.*) http://ourdomain.com/$1 [R,L]
答案 1 :(得分:2)
尝试
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} 443
RewriteRule ^blog/?(.*) http://ourdomain.com/blog/$1 [R,L]
RewriteCond %{SERVER_PORT} 443
RewriteRule ^videos/?(.*) http://ourdomain.com/videos/$1 [R,L]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/videos
RewriteCond %{REQUEST_URI} !^/blog
RewriteRule ^(.*)$ https://ourdomain.com/$1 [R,L]
答案 2 :(得分:0)
另一种解决方案。我希望它会有所帮助。
RewriteEngine on
Rewritebase /
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTPS} =off [OR]
RewriteCond %{ENV:HTTPS} =off
RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]