Hello,

Is there a way to set up of custom html pages to replace the default pages that error throw?

I use htaccess to deny some IPs from members via FireWall. Every time these members access my site, they will receive an error.

However, I want to set up a custome page to replace the default pages that error throw.

How do I set such a default page for that error?

Thanks.

HAPPY NEW YEAR!

Member Avatar for LastMitch

Is there a way to set up of custom html pages to replace the default pages that error throw?

You mean these errors:

400 - Bad request
401 - Authorization Required
403 - Forbidden
404 - Wrong page
500 - Internal Server Error

If you don't know how to create a error pages you can read this:

http://www.hongkiat.com/blog/60-really-cool-and-creative-error-404-pages/

It will give you an idea on how to create one.

on the .htaccess file you need to add this (just an example):

DirectoryIndex index.php
ErrorDocument 400  /400.php 
ErrorDocument 401  /401.php 
ErrorDocument 403  /403.php 
ErrorDocument 404  /404.php 
ErrorDocument 500  /500.php 

Regarding about blocking (Deny) and allowing (Allow) it should look like this on your htaccess file (just an example):

#Deny List
order allow,deny
deny from 125.126.127.128 #specify a specific address
deny from 125.126.127.128/29 #specify a subnet range
deny from 125.126.* #specify an IP address wildcard
allow from all

#Allow List
order allow,deny
allow from 145.146.147.148 #specify a specific address
allow from 145.146.147.148/40 #specify a subnet range
allow from 145.146.* #specify an IP address wildcard
deny from all
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.