【问题标题】:htaccess redirecting one url to load from anotherhtaccess 重定向一个 url 以从另一个加载
【发布时间】:2016-03-23 09:12:19
【问题描述】:

我正在尝试重定向我网站中的一个 URL,但我收到错误 404 not found 我正在尝试重定向此网址:http://www.stoikovstroi.com/bg/противопожарни-врати

要从这个加载:http://www.stoikovstroi.com/vina/index.php/protivpojarni-vrati

RewriteEngine On
RewriteCond %{HTTP_HOST} ^stoikovstroi\.com\bg\противопожарни-врати$ [OR]
RewriteCond %{HTTP_HOST} ^www\.stoikovstroi\.com\bg\противопожарни-врати$
RewriteCond %{REQUEST_URI} !^/vina/index.php/protivpojarni-vrati
RewriteRule (.*) /vina/$1/index.php/protivpojarni-vrati

【问题讨论】:

    标签: .htaccess redirect


    【解决方案1】:

    在站点根目录 .htaccess 中使用此规则:

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^(www\.)?stoikovstroi\.com$ [NC]
    RewriteRule ^bg/противопожарни-врати/?$ /vina/index.php/protivpojarni-vrati [L,NC,R=302,B]
    

    /vina/.htaccess 目录中使用此规则:

    RewriteEngine On
    RewriteBase /vina/
    
    RewriteRule ^((?!index\.php/).*)$ index.php/$1 [L,NC]
    

    【讨论】:

    猜你喜欢
    • 2017-05-21
    • 1970-01-01
    • 2013-08-04
    • 1970-01-01
    • 2022-01-13
    • 2012-12-04
    • 2017-05-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多