2013-09-24 81 views
1

我使用Yii Framework創建網站並嘗試隱藏輸入腳本。在我的本地(MAMP)服務器中一切正常,但是當我將它部署到我的Uni的Linux服務器時,我遇到了問題。我想它與UserDir有關,但我不確定。UserDir和mod_rewrite

當我請求: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?或者用我的.htaccessmod_rewrite?或者配置Yii

回答

0

首先,試試這個:

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

接下來,麻煩可能是因爲Apache的配置。選項「AllowOverride」應設置爲「全部」:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    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> 
+0

謝謝。如果我使用'RewriteBase /'我得到'/〜index.php'。任何想法是什麼導致那個代字符在那裏?我知道我們的個人網站也可以從http:// website /〜username /'訪問,它重定向到http:// website/username /',但我沒有訪問apache配置。 – gozzilli