PDA

View Full Version : creating a custom forbidden page?


Monty
09-10-2006, 08:42 PM
http://www.aota.net/forums/showthread.php?t=13343&highlight=custom+403

Is this thread still relevant? I want to send forbidden IP's in my .htaccess file to a special page and can't seem to get it to work for me (banning myself).

TIA for any help.

sheila
09-10-2006, 08:49 PM
Yes, that thread is pertinent and the methods described therein still apply and should work.

Tell exactly what you've done so far and what results you are seeing? Maybe if you give us the name of the domain you're testing on we could get a better idea of what may be going on?

Where can we see and test this for ourselves?

Monty
09-10-2006, 08:57 PM
the IP listed is my dedicated cable IP. Some of this file is what Terra recommended I use for other reasons. It's at the root of MQS0016 (main domain there)


### CNC_START: BEGIN CUSTOM WEBSITE CONFIGURATION
### DO NOT EDIT THIS SECTION, CHANGES WILL BE LOST
Options +Indexes
php_value error_reporting 7
php_flag display_errors off
### CNC_END: END CUSTOM WEBSITE CONFIGURATION
###Turn off register globals start
php_flag register_globals off
###Turn off register globals end
###start Ban
order allow,deny
deny from 24.174.37.255
allow from all
###end Ban
###start custom redirect for errors
ErrorDocument 403 /403.html
###end custom redirect for errors


the file I want it to redirect to is at /www/403.html

Thanks for any help. I may be seeing an ISP cache, but if I am, I can't clear it.

sheila
09-10-2006, 09:04 PM
I took a peek, and the .htaccess file to which you have added the statements for the 403 ErrorDocument is above the /www directory.

I would try placing those statements into the .htaccess that is WITHIN your /www directory.

The filepath
/403.html

doesn't make sense when it is above the /www directory (I believe).

Monty
09-10-2006, 09:13 PM
I created a 2nd .htaccess file and put it into the /www directory


###start Ban
order allow,deny
deny from 24.174.37.255
allow from all
###end Ban
###start custom redirect for errors
ErrorDocument 403 /403.html
###end custom redirect for errors

which gave me the following via my browser:

Forbidden
You don't have permission to access /403.htm 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 2coolfishing.com Port 80

Maybe 403's are a special case at FQ for billing reasons?

sheila
09-10-2006, 09:30 PM
You need to remove the 403 ErrorDocument lines from the .htaccess above the /www directory. At least, that is the next thing I would try.

Monty
09-10-2006, 10:04 PM
I tried the following code

at the root .htaccess


### CNC_START: BEGIN CUSTOM WEBSITE CONFIGURATION

### DO NOT EDIT THIS SECTION, CHANGES WILL BE LOST

Options +Indexes

php_value error_reporting 7

php_flag display_errors off

### CNC_END: END CUSTOM WEBSITE CONFIGURATION

###Turn off register globals start

php_flag register_globals off

###Turn off register globals end

###start Ban

###order allow,deny

###deny from 24.174.37.255

###allow from all

###end Ban

###start custom redirect for errors

###ErrorDocument 403 /403.html

###end custom redirect for errors

in the www directory


###start Ban

order allow,deny

deny from 24.174.37.255

allow from all

###end Ban

###start custom redirect for errors

ErrorDocument 403 /403.html

###end custom redirect for errors

result via browser


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.



desired redirect

domain.com/403.html

====

the current .htaccess file in the www directory is commented out so I can have access to my site again.

There is *no rush* on a solution here. I want to be able to shoot banned users to another page/site instead of the UNIX standard page.

Monty
09-11-2006, 03:50 PM
this code


###start Ban
order allow,deny
deny from 70.216.46.91
allow from all
###end Ban
###start custom redirect for errors
ErrorDocument 403 /403.html
###end custom redirect for errors


placed in the www folder did the trick. Thanks for the help, Sheila!

sheila
09-12-2006, 06:39 PM
Good deal. :)
:QTthumb: