我刚刚浏览了http://tutorial.symblog.co.uk/docs/customising-the-view-more-with-twig.html
上的Symblog教程在产品模式下,如果我像这样访问网址:
我的主页上有所有博文的链接。
但是,如果我点击其中一篇博文,那么我会得到一个404,实际上任何链接(对于约或联系)都返回404,例如:
如果我通过app_dev.php访问prod模式,则所有链接都会再次运行,即:
我已经运行以确保mod重写应该正常工作并重新启动apache但没有快乐。
sudo a2enmod actions
有谁知道为什么会这样?
谢谢, 约翰
PS:这是我正在学习的开发站点的当前vhost文件(Ubuntu lts,apache 2.4,php 5.4ish)
<virtualhost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster@domain.com
ServerName mysite.co.uk
ServerAlias www.mysite.co.uk
ServerAlias local.mysite.co.uk
# Index file and Document Root (where the public files are located)
DirectoryIndex app.php
DocumentRoot /var/webroot/www/vhosts/mysite.co.uk/htdocs/Symfony/web/
# Custom log file locations
LogLevel warn
ErrorLog /var/webroot/www/vhosts/mysite.co.uk/log/error.log
CustomLog /var/webroot/www/vhosts/mysite.co.uk/log/access.log combined
</virtualhost>
当我向vhost文件添加AllowOverride All
并重新启动apache时,我得到了以下错误:
* Starting web server apache2
*
* The apache2 configtest failed.
Output of config test was:
AH00526: Syntax error on line 15 of /etc/apache2/sites-enabled/mysite.co.uk.conf:
AllowOverride not allowed here
Action 'configtest' failed.
The Apache error log may have more information.
答案 0 :(得分:0)
改变vhost工作(感谢https://stackoverflow.com/users/308825/maerlyn)。
使用Allowoverride All放置目录标记可解决此问题。似乎重写是特定于每个vhost的。
这是我的symfony教程的配置,它现在在prod模式下运行:
<directory /var/webroot/www/vhosts/mysite.co.uk/htdocs/Symfony/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</directory>
<virtualhost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster@domain.com
ServerName mysite.co.uk
ServerAlias www.mysite.co.uk
ServerAlias local.mysite.co.uk
# Index file and Document Root (where the public files are located)
DirectoryIndex app.php
DocumentRoot /var/webroot/www/vhosts/mysite.co.uk/htdocs/Symfony/web/
# Custom log file locations
LogLevel warn
ErrorLog /var/webroot/www/vhosts/mysite.co.uk/log/error.log
CustomLog /var/webroot/www/vhosts/mysite.co.uk/log/access.log combined
</virtualhost>