I have the next rule:
RewriteCond %{HTTP_REFERER} ^$ [OR]
RewriteCond %{HTTP_REFERER} !^https?://itransformer.*$ [NC]
RewriteRule \.(gif|jpe?g|png|wbmp)$ - [R=403,L]
in the main .htaccess
file.
When anyone try to hotlink an image, he will get a 403 response. However, he's getting a 404 response. If I comment the lines above, I get no error.
Seems to be due to Twig exception templates.
I'm overriding some error templates from Twig exception templates.
I've successfully overridden the 404 error template by adding the file: /app/Resources/TwigBundle/views/Exception/error404.html.twig
.
And tried to override the 403 error template. Tried adding: /app/Resources/TwigBundle/views/Exception/error403.html.twig
but is not shown.
There are not ErrorDocument
in Apache configuration, neither .htaccess
files.
Why is it throwing a 404 response, when it should throw a 403?