Forum Moderators: DixonJones
I want to show custom 404 and 403 pages.
It works for the 404 page, but not for the 403 page.
This is the code in my .htacesss file:
ErrorDocument 403 /error403.html
ErrorDocument 404 /error404.html
<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 12.101.152.#*$!
deny from 12.147.139.xxx
etc.
The message they get is this:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.33 Server at www.mydomain.com Port 80
Thanks ahead!
Start here: Apache mod_access [httpd.apache.org].
(I'd do you a disservice by giving you yet more code that you don't understand...)
Jim
Would this work?
ErrorDocument 403 /error403.html
ErrorDocument 404 /error404.html
***added this***
<Files error403.html>
Allow from all
</Files>
****************
<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 12.101.152.#*$!
deny from 12.147.139.xxx
etc.
Another way to do it is:
ErrorDocument 403 /error403.html
ErrorDocument 404 /error404.html
#
SetEnvIf Request_URI "/error40[34]\.html$" allowit
SetEnvIf Request_URI "^/robots.\txt$" allowit
Order Deny,Allow
Deny from 12.101.152.***
Deny from 12.147.139.***
Allow from allowit
It might take some very careful reading of the mod_access Order directive documentation to see how this works, but it's similar to what I use on my sites.
Jim
Now the document looks like this:
ErrorDocument 403 /error403.html
ErrorDocument 404 /error404.html
#
SetEnvIf Request_URI "/error403\.html$" allowit
SetEnvIf Request_URI "/error404\.html$" allowit
SetEnvIf Request_URI "^/robots.\txt$" allowit
Order Deny,Allow
deny from 12.101.152.#*$!
deny from 12.147.139.xx
Allow from allowit
Now, I'll just wait and see if my proxy/anonymizer-using troll brigade complains... ;-)