Forum Moderators: phranque
I have created a .htaccess with ErrorDocument 404 /404.php and a customized 404.php which are also in the root i.e. public_html.
Now if I type a wrong url as www.mydomain.com/wrong it's showing my 404 page. But if I add a slash after the url i.e. www.mydomain.com/wrong/ then the 404 page is coming up but without the css and js, and all the relative links are showing up under the subdirectory i.e. www.mydomain.com/wrong/about.php when it should be www.mydomain.com/about.php
Please help me to figure out what I'm missing.
So, a call from "/somepage" will be addressed as "/" + filename.
A call from "/folder/somepage" will be addressed as "/folder/" + filename.
A call from "/folder/somepage/" will be addressed as "/folder/somepage/" + filename.
It is working exactly as coded and exactly as per the specs.
.
If you want it to work some other way, then you need to address your stylesheet using links that begin with a leading slash, like "/stylesheet.css" or perhaps "/css/styles.css" instead.
That way, the CSS location is specified "counting from the root of the site" and the URL of the page that it is being called from is totally irrelevant to the calculation.
Jim