我想用apache ErrorDocument替换symfony的错误模板。
我有以下conf:
<VirtualHost *:80>
ServerName localhost-de
ServerAdmin me@mydomain.com
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
ErrorDocument 404 /staticErrorPage.html
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /kontakt "/var/www/html/contact/web"
Alias /skin "/var/www/html/skin"
RewriteEngine on
RewriteRule ^/skin/(.{7})/(.*) /skin/$2
SetEnv locale de_DE
</VirtualHost>我的Symfony应用程序位于"/var/www/html/contact/“下。当我进入一个不存在的页面,比如"localhost-de/foo“,我得到的是我的html页面的内容。但是当我进入一个不存在的页面时,比如"localhost-de/kontakt/foo“,我总是得到symfony/twig页面的内容。
我知道我可以重写twig模板,但我不希望这样。你知道怎么处理这件事吗?
发布于 2018-04-02 03:43:22
ErrorDocument仅用于您指定的目录。您应该在Location或LocationMatch指令中包含ErrorDocument。有关更多详细信息,请阅读apache文档。
https://stackoverflow.com/questions/49323371
复制相似问题