Unable to Apply CSS Changes to 404 Error Page
EDIT: page in question:
Right from the start: I have ruled out any relative path issues. I have specified a base href in my header like this:
<base href="https://hinnahackers.no/">
I am aware that this setup is functioning, as my 404 page loads some styles from my CSS file, but not the newly added classes.
It's not an issue related to forcing a refresh of the CSS file either, because I am already using styles.css?v=X:
<link href="css/styles.css?v=749" rel="stylesheet" type="text/css" />
However, these changes do not seem to reflect on my 404 page. The CSS updates properly on other pages such as index.php.
This is the content of my .htaccess file which includes rules for redirecting users to 404.php if they enter an invalid URL:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
#Rewrite everything to https
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#404 redirect
ErrorDocument 404 /404.php
In my CSS file, I have included the following new classes:
.404__heading {
font-size: 2em;
color: #fff;
line-height: 1.5;
}
// More styling classes here...
Unfortunately, these classes are not being recognized on my 404.php page. As a temporary solution, I have applied the styles directly within the 404 page. I'm puzzled as to why this is happening and despite extensive searching, I haven't been able to find a resolution.