1

我为一位朋友接管了一个托管帐户,以便在他的服务器上托管第二个域。一切都很好,除了由设计他的第一个站点的人生成的 .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 文件以允许访问两个站点的所有页面的任何想法?

4

1 回答 1

0

添加条件以检查主机名:

<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>
于 2012-10-24T01:25:31.527 回答