: .htaccess errordocument 404 for .htm and .html My .htaccess is displayed below. It catches example.com/abcnonsense and sends it to my error page - 404error.htm. But fails to catch example.com/abcnonsense.htm
My .htaccess is displayed below.
It catches example.com/abcnonsense and sends it to my error page - 404error.htm.
But fails to catch example.com/abcnonsense.htm or example.com/abcnonsense.html.
In these cases it redirects to my home page.
Can anyone see where I am going wrong?
ErrorDocument 404 /404error.htm
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^myexample.com
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^(.*)$ www.myexample.com/ [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{DOCUMENT_ROOT}/index.html -f
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^$ /index.html [NC,L]
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^index.html$ / [NC,R,L]
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^index.htm$ / [NC,R,L]
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^$ /index.htm
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^(.*.x?h?t?ml?)$ /cgi-bin/cms.cgi?a=pg&p=%{REQUEST_URI}&%{QUERY_STRING} [NC,L]
More posts by @Courtney195
1 Comments
Sorted by latest first Latest Oldest Best
RewriteRule ^(.*.x?h?t?ml?)$ /cgi-bin/cms.cgi?a=pg&p=%{REQUEST_URI}&%{QUERY_STRING} [NC,L]
Because the very last line rewrites all .htm and .html requests to your /cgi-bin/cms.cgi script. Any 404's that result from .htm or .html requests would therefore need to be managed by this script. In other words, your CMS needs to manage the 404, not Apache.
EDIT: Unless... your CMS only works on .htm or .html files that physically exist on the filesystem? (Although I doubt this.)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.