我使用这个代码
RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
将所有请求redirect到HTTPS,这是没问题的。
现在我想要除了一个文件index810.PHP以外的其他东西
当我这样写
htaccess mod_rewrite
精确定位Filesmatch指令
htaccess阻止访问.PHP,并只允许使用RewriteRule
.htaccess用get参数重写url
RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !^ index810.PHP RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
我得到太多的redirect,任何build议。
先谢谢你
国防部重写+哈希标签
Apache RewriteRule删除任何域名上的端口
如果通过htaccess查询string参数不存在,则将HTTPSredirect到HTTP
用SetEnv重写
.htaccess使用GET参数redirect
解决方案是使用非重写规则:
# do nothing for /index810.PHP RewriteRule ^index810.PHP$ - [L] # else ... RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI}
你的模式是错误的:
%{REQUEST_URI}是所有的HTTP路径(即,如果在文档根目录下,它将是=/index810.PHP )
接受的答案不适合我。 但是,
RewriteCond %{THE_REQUEST} !/index810.PHP [NC] RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。