lbh2011 Posted May 25, 2011 Share Posted May 25, 2011 Hi, In my .htaccess I have used the following code to provide an error page for my site: ErrorDocument 400 /error.php ErrorDocument 401 /error.php ErrorDocument 403 /error.php ErrorDocument 404 /error.php ErrorDocument 500 /error.php If I access a page which doesn't exist at www.example.com/unknownpage.php then the error page will appear formatted correctly with css etc. If I however access an unknown page in a subdirectory e.g. www.example.com/directory/unknownpage.php then the site will appear as text only without any formatting or image. I know this can be resolved by linking the css file via it's full URL (along with all the other media on the error page) is there a better more efficient way? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/237416-error-page-formatting/ Share on other sites More sharing options...
dragon_sa Posted May 25, 2011 Share Posted May 25, 2011 As they are all the same page you could just include the css styles in the head of the actual error.php page instead of linking to a separate style sheet, other wise absolute urls is the only way to go to make them relative to every possible directory structure. Quote Link to comment https://forums.phpfreaks.com/topic/237416-error-page-formatting/#findComment-1219928 Share on other sites More sharing options...
lbh2011 Posted May 25, 2011 Author Share Posted May 25, 2011 I know I can go and do that, I was hoping that there was a way of doing it via the htaccess. Is it possible to include the full url to the error page in the ErrorDocument link of the htaccess? Quote Link to comment https://forums.phpfreaks.com/topic/237416-error-page-formatting/#findComment-1219959 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.