Redirect htaccess重定向不适用于某些浏览器

Redirect htaccess重定向不适用于某些浏览器,redirect,https,cross-browser,Redirect,Https,Cross Browser,这是入口 RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NCL] 第一条规则检查你是否有www,如果没有重定向到www+https,下一条规则

这是入口

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

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NCL]
第一条规则检查你是否有www,如果没有重定向到www+https,下一条规则检查客户端是否通过https访问网站,一切正常,除了opera,opera重定向我,使我喜欢它将域+请求uri放入{request_uri},我似乎无法让它正常工作。有什么建议可以让它正常工作吗? 编辑:
IE也不起作用。它只是给出了服务器错误。

重定向是由Apache完成的,因此Opera对此错误无罪。我测试了你的规则,发现一个错误:

RewriteRule: unknown flag 'NCL'
试试这个:

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

10x:),您是如何测试规则的?我想知道如何调试。htaccess我在httpd-vhosts.conf中为域启用了error.log:ErrorLog“d:/www/site/logs/error.log”,create/logs dir,Apache将在那里为您写入错误。请接受好的答案。