Pregunta

I'm using the Yii framework at my company site.

I have a frontend at domain.com/... and a Yii based app at domain.com/app/.. . We recently added a 404 page to the frontend site, with htaccess's ErrorDocument handler at the frontend. Problem is, the Yii app inherits from that 404, which gives a bad page. How can I force it to use Yii's embedded error handling page?

Thanks in advance.

¿Fue útil?

Solución 2

Ended up using a RewriteCond redirection instead of ErrorDocument, resulting in a "rule" for the file to be redirected. Basically something like this:

RewriteCond %{REQUEST_URI} !^/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /404.php

Basically this means, "if file requested is not valid file, use this rewriterule". The first condition is to make sure it excludes the "app" folder, so it handles its own errors.

Otros consejos

There are 2 good article talking bout this:

How to use default layout for error pages instead of errorXXX views

Handling errors using an action

The idea is, you create a action in out main Controller that will handle all page errors, so, you can change your htaccess to redirect your application to the Controller:

domain.com/site/error
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top