Anton_Aligned_Assets Posted October 20, 2014 Share Posted October 20, 2014 Hi guys, I was wondering whether I could get some assistance with a problem I'm having: I've started looking after my company's website and have recently set up a custom 404 error page for it. My .htaccess file reads: ErrorDocument 404 /404.html The problem I've got is that it's not working properly all the time. When the incorrect URL looks like this: www.companydomain.com/xxx everything works fine, but when an additional forward slash gets added in it stops working properly , for example if the URL looks like www.companydomain.com/xxx/yyy. The 404 goes through, and it tries to load the page, but all of the formatting to the text goes out the window and none of the linked images on the page, such as the header on the top, gets pulled through - instead of the images I get the black box with an X in it. What have I done wrong, and what do I need to do so that the correct 404 error page comes up for any combination put after the domain name. If anyone has any suggestions i'd be very grateful. Thanks! Link to comment Share on other sites More sharing options...
thescientist Posted October 20, 2014 Share Posted October 20, 2014 what do you get in the console? Can you share a link? Sounds like the CSS isn't loading correctly Link to comment Share on other sites More sharing options...
Ingolme Posted October 20, 2014 Share Posted October 20, 2014 Your 404 page will need an absolute link to the stylesheet. You can do that by prepending the URL with a / to indicate that it's always relative to the site root and not the file's current location. <link href="/css/style.css" rel="stylesheet" type="text/css"> Link to comment Share on other sites More sharing options...
Anton_Aligned_Assets Posted October 23, 2014 Author Share Posted October 23, 2014 Thanks Ingolme, that worked perfectly! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now