apache - 为什么这会导致我的网站重定向到 secure.secure.*root domain*.com?

标签 apache mod-rewrite redirect ssl subdomain

这是我正在使用的重写规则:

RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} !^(www.)secure.\ [NC]
RewriteRule (.*) https://secure.%{HTTP_HOST}%{REQUEST_URI} [R,L]

如果端口为 443(SSL 端口)并且请求的域不是以 secure 或 www.secure 开头,则应该应用此规则。

相反,它重定向到 secure.secure,然后返回 404 错误。或者,如果我从创建重写规则中删除安全

RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} !^(www.)secure.\ [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

我收到太多重定向错误。

我承认,我不是 mod_rewrite 专家,但我认为自己可以引用文档进行操作。然而,在这一点上,我很难过。谢谢!

最佳答案

分组 (www.) 不是有条件的。这应该类似于 (www.)?http://httpd.apache.org/docs/current/rewrite/intro.html以获得更广泛的文档。

关于apache - 为什么这会导致我的网站重定向到 secure.secure.*root domain*.com?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6890297/

相关文章:

Desknow 应用程序上的 Java JCE 安全错误

apache - mod_rewrite 'add path info postfix:'

bash - 如何将程序的输出同时定向到控制台和日志文件?

php - IP 地理位置与 Mod_Rewrite & PHP

css - 在 htaccess 中使用 RewriteRule 后,在 html 中使用时不会加载相对路径

apache 反向代理更改 url

apache - ELB 或 EC2 上的 SSL 证书?

mysql - 如果一切都已设置并连接,为什么 Coldfusion-MySQL-Apache 不在本地主机上运行?

node.js - ubuntu 16.04 上的 Nodejs - 在控制台中运行脚本时出错

php - 从 url 中删除 app/webroot