【问题标题】:How to change.htaccess to allow access to multiple pages如何更改.htaccess 以允许访问多个页面
【发布时间】:2012-10-24 09:25:31
【问题描述】:

我为一位朋友接管了一个托管帐户,以便在他的服务器上托管第二个域。一切都很好,除了由设计他的第一个网站的人生成的 .htaccess 文件。

主站点是:ra-pictures.com,托管在根文件夹/

我正在开发的网站是 posthumanmovie.com,它位于 /posthuman 文件夹中

这是当前的 .htaccess 文件:

<IfModule mod_rewrite.c>
    RewriteEngine on

    # route non-existant requests to single script
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
    RewriteRule ^.*$ index.php [QSA,NS]

</IfModule>

当我尝试访问 posthumanmovie.com 时 - 我收到 404 not found 错误。

当我删除 .htaccess 文件时,它可以工作,但他的其他网站 ra-pictures.com 在任何不是索引页面的页面上都有 404 错误。关于如何更改 .htaccess 文件以允许访问两个站点的所有页面的任何想法?

【问题讨论】:

    标签: .htaccess subdomain


    【解决方案1】:

    添加条件以检查主机名:

    <IfModule mod_rewrite.c>
        RewriteEngine on
    
        RewriteCond %{HTTP_HOST} ra-pictures\.com$ [NC]
        # route non-existant requests to single script
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
        RewriteRule ^.*$ index.php [QSA,NS]
    
    </IfModule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-31
      • 1970-01-01
      • 2011-01-02
      • 1970-01-01
      相关资源
      最近更新 更多