I realized that my host’s default 404 pages were filled with spammy links, so I figured I should make up a custom 404 page for my websites.
I followed the directions from my host’s support pages, but I don’t have it quite right.
In my home folder, I have an .htaccess file with the following code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /404.php
It works fine if someone goes to http://www.mysite.com/wrongpage, but if someone goes to http://www.mysite.com/subdirec…../wrongpage, all the styling of the 404 page is gone. Plus, none of the links work because it’s trying to go relative to the subdirectory, when it should be going relative to the site root…
What am I doing wrong?