2012-08-15 80 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 
相关问题