1

我正在使用 Yii 框架创建一个网站并试图隐藏入口脚本。在我的本地(MAMP)服务器上一切正常,但是当我将它部署到我的 Uni 的 Linux 服务器上时,我遇到了问题。我想它与 相关UserDir,但我不确定。

当我请求时:http://website/username/site/research 我得到:

The requested URL /~home/username/public_html/index.php was not found on this server.

我的.htaccess样子是这样的:

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule ^.*$ index.php

我不知道从哪里开始调查这个问题。可以与UserDir吗?还是用我的.htaccessand mod_rewrite?或配置Yii?

4

1 回答 1

0

首先,试试这个:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

接下来,麻烦可能是因为 apache 配置。选项“AllowOverride”应设置为“All”:

<VirtualHost *:80>
    ServerAdmin admin@localhost
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /home/sites/example.com/frontend/www

    DirectoryIndex index.php index.html
    <Directory /home/sites/example.com/frontend/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
                allow from all
    </Directory>
</VirtualHost>
于 2013-09-24T11:16:33.670 回答