2012-08-15 54 views
0

我已經開發了一個CakePHP應用程序,現在我已經部署到了我的生產服務器,但是漂亮的URL不起作用。CakePHP漂亮的URL在生產服務器上不起作用

這裏是我的網站的Apache虛擬主機:

<VirtualHost *:80> 
     ServerName site.com 
    ServerAdmin [email protected] 

    DocumentRoot /home/whitey/sites/site.com/htdocs/app/webroot/ 
    <Directory /> 
     Options FollowSymLinks 
     AllowOverride None 
    </Directory> 
    <Directory /home/whitey/sites/site.com/htdocs/app/webroot/> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     Order allow,deny 
     allow from all 
    </Directory> 

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
    <Directory "/usr/lib/cgi-bin"> 
     AllowOverride None 
     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
     Order allow,deny 
     Allow from all 
    </Directory> 

    ErrorLog /home/whitey/sites/site.com/logs/error.log 

    # Possible values include: debug, info, notice, warn, error, crit, 
    # alert, emerg. 
    LogLevel warn 

    CustomLog /home/whitey/sites/site.com/logs/access.log combined 

    Alias /doc/ "/usr/share/doc/" 
    <Directory "/usr/share/doc/"> 
     Options Indexes MultiViews FollowSymLinks 
     AllowOverride None 
     Order deny,allow 
     Deny from all 
     Allow from 127.0.0.0/255.0.0.0 ::1/128 
    </Directory> 

</VirtualHost> 

正如你所看到的,文檔根目錄設置爲我的應用程序的webroot目錄。在這個目錄中,有這樣的.htaccess文件:

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^$ app/webroot/ [L] 
    RewriteRule (.*) app/webroot/$1 [L] 
</IfModule> 

這整個安裝工作​​完全與我的運行XAMPP本地機器上,所以我不知道什麼是錯的。我唯一能想到的是重寫規則不會因爲我的虛擬主機中的設置而生效。但是我沒有足夠的Apache配置文件知識來了解如何解決這個問題。

謝謝。

回答

1

沒關係,我是個白癡。我昨晚在設置Apache時忘了啓用mod_rewrite模塊。這裏的修復:

sudo a2enmod rewrite 
sudo service apache2 restart 
相關問題