CSS does not work on pages generated with ErrorDocument

1

I'm having a problem when I'm going to customize ERROR 404. I put the following code in the .htaccess file:

ErrorDocument 404 /erro404.html

And I created a custom page error404.html. The page is onpage, you do not have a link to other pages.

When I type for ex. MYSITE / CONTACT falls into error 404.html, so far so good. But when I put it for ex. myite / contact / (bar) it does not pull the css (it's all unconfigured). What can it be?

    
asked by anonymous 22.08.2015 / 00:50

2 answers

2

Change your css links to point to the root of the server, for example, if you look like this:

 <link rel="stylesheet" type="text/css" href="css/style.css"> 

Change and put it like this:

 <link rel="stylesheet" type="text/css" href="/css/style.css"> 

See that there is a difference in href , has a slash at startup, this indicates that your css file is inside the css folder that is at the root of the server.

    
22.08.2015 / 01:23
1

Add the following html code to your error404.html page:

If the css, js, and images folders are in the root:

<base href="/">

Or you can try this:

<base href="http://www.examplo.com/">

This tag points to resources loading as if they were on the page specified in <base> .

Source: link

    
22.08.2015 / 01:06