Reputation: 35
I'm new to .htaccess
files and I have the following problem: I try to redirect to 404 page but if URL contains a directory that doesn't exist, the error page loses its format.
This is my code:
RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]
ErrorDocument 404 /404.html
Upvotes: 0
Views: 54