Jump to content

Error Page Formatting


lbh2011

Recommended Posts

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 :)

 

Link to comment
https://forums.phpfreaks.com/topic/237416-error-page-formatting/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.