开发者

Why does this cause my site to redirect to secure.secure.*root domain*.com?

开发者 https://www.devze.com 2023-03-25 10:06 出处:网络
Here is the rewrite rule I am using: RewriteCond %{SERVER_PORT} ^443$ RewriteCond %{HTTP_HOST} !^(www.)secure.\\ [NC]

Here is the rewrite rule I am using:

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

This rule is supposed to be applied if the port is 443 (SSL port) and if the requested domain does not start with secure or www.secure .

Instead, it redirects to secure.secure and then returns a 开发者_开发技巧404 error. Alternatively, if I remove the secure from rewrite rule creating

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

I get a too many redirects error.

I admit, I am not a mod_rewrite expert, but I consider myself able to function with referring to the documentation. On this however, I am stumped. Thanks!


The grouping (www.) is not conditional. This should be something like (www.)?. http://httpd.apache.org/docs/current/rewrite/intro.html for more extensive documentation.

0

精彩评论

暂无评论...
验证码 换一张
取 消