Reply
htaccess ban ip but allow to see custom 403 page...
Old 12-15-2007, 06:20 PM htaccess ban ip but allow to see custom 403 page...
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,283
Name: Dan
Location: Swindon
Ok, jsut about to set up my ip banning script, ok htacess

how do i ban a ip but still allow them to see my custom 403 (error.php?type=403) but at the moment it blocks the page,so i get the deault 403 and shows error finding the 403 page?

thanks,
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
When You Register, These Ads Go Away!
Old 12-15-2007, 11:05 PM Re: htaccess ban ip but allow to see custom 403 page...
Extreme Talker

Posts: 237
Location: United States
The first part below is the ip blocking section of the .htaccess, and the last line changes the default 403 error to a page of your choice.

Code:
order allow,deny
deny from 127.0.0.1
deny from 1.2.3.4
allow from all

ErrorDocument 403 /your_directory/error.php?type=403
__________________
The interlocking pieces of web development: usability, performance, accessibility, and standards.
frost is offline
Reply With Quote
View Public Profile
 
Old 12-16-2007, 09:17 AM Re: htaccess ban ip but allow to see custom 403 page...
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,283
Name: Dan
Location: Swindon
just tried it but it dont work

im using:
Code:
order allow,deny
deny from 86.21.65.226 
allow from all
ErrorDocument 505 /error.php?type=505
ErrorDocument 504 /error.php?type=504
ErrorDocument 503 /error.php?type=503
ErrorDocument 502 /error.php?type=502
ErrorDocument 501 /error.php?type=501
ErrorDocument 500 /error.php?type=500
ErrorDocument 400 /error.php?type=400
ErrorDocument 401 /error.php?type=401
ErrorDocument 403 /error.php?type=403
ErrorDocument 404 /error.php?type=404
ErrorDocument 405 /error.php?type=405
ErrorDocument 408 /error.php?type=408
ErrorDocument 415 /error.php?type=415
ErrorDocument 301 /error.php?type=301
ErrorDocument 302 /error.php?type=302
and im still getting the default and error serving the error.php page
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 12-16-2007, 10:52 AM Re: htaccess ban ip but allow to see custom 403 page...
Extreme Talker

Posts: 237
Location: United States
The ErrorDocument handler might be relative to your base web directory, not the .htaccess file. Is it possible that your error.php file is in a subdirectory? For example, if your error document was located at www.example.com/hi/error.php, then it would most likely need to be ErrorDocument 403 /hi/error.php?type=403
__________________
The interlocking pieces of web development: usability, performance, accessibility, and standards.
frost is offline
Reply With Quote
View Public Profile
 
Old 12-16-2007, 11:07 AM Re: htaccess ban ip but allow to see custom 403 page...
dansgalaxy's Avatar
Eat, Sleep, Code

Posts: 6,283
Name: Dan
Location: Swindon
No its in my root, you can see it here: http://calm.dansgalaxy.co.uk/error.php please dont go on it too much i dont want a flood of emails
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk (only for members!)
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to htaccess ban ip but allow to see custom 403 page...
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14314 seconds with 12 queries