Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.