【问题标题】:.htaccess Editor - Too Many Redirects.htaccess 编辑器 - 重定向太多
【发布时间】:2015-12-16 00:54:38
【问题描述】:

我正在尝试将任何虚假的前端子域重定向到我的主页。例如, 伪造.ecer.ca 重定向到 www.ecer.ca

下面是我的.htaccess编辑器代码:

ErrorDocument 404 http://www.ecer.ca/error/index.php

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

RewriteCond %{HTTP_HOST} !^ecer\.ca$ [NC]
RewriteRule (.*) http://ecer.ca/$1 [L,R=301]

【问题讨论】:

    标签: .htaccess redirect


    【解决方案1】:

    你可以使用:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^(www\.)?ecer\.ca$ [NC]
    RewriteRule (.*) http://www.ecer.ca/$1 [L,R=301]
    

    【讨论】:

    • 非常感谢!你是救生员!
    猜你喜欢
    • 2019-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多