【问题标题】:couple slim redirection to index.php with domain redirection使用域重定向将纤薄的重定向到 index.php
【发布时间】:2017-01-03 18:55:11
【问题描述】:

我有一个 slim 应用程序,我想重定向到一个新域(比如 www 到非 www,但此时它是一个完全不同的域)。我不知道该怎么做,规则使重定向像

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

RewriteCond %{HTTP_HOST} ^www.exampledomain.com [NC]
RewriteRule ^(.*)$ www.example-domain.com/$1 [L,R=301,NC]

www.exampledomain.com -> www.example-domain.com/index.php

我无法控制 exampledomain.com,因为它是由 orange 管理的邮件服务器,而 example-domain.com 由 ovh 管理(我们拥有两个域)。

提前致谢!

【问题讨论】:

    标签: php .htaccess redirect slim


    【解决方案1】:

    通过在域上添加重写规则找到解决方案

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_HOST} ^www.example-domain.com
    RewriteRule ^ index.php [QSA,L]
    
    RewriteCond %{HTTP_HOST} ^www.exampledomain.com
    RewriteRule ^(.*) http://www.example-domain.com/$1 [NC]
    

    【讨论】:

      猜你喜欢
      • 2013-06-26
      • 2014-01-07
      • 1970-01-01
      • 2013-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-18
      • 1970-01-01
      相关资源
      最近更新 更多