Forum Moderators: phranque

Message Too Old, No Replies

.htaccess ban, one page accessisible

How would I do that?

         

skinter

12:06 am on Jun 8, 2005 (gmt 0)

10+ Year Member



I want to have one page that the people I ban can still view. Right now everything is banned, and I don't know how to make one page still viewable. Does anyone know how to do this?

jdMorgan

2:31 am on Jun 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



skinter,

Welcome to WebmasterWorld!

Please post your current relevant code so we can discuss it.

It's quite easy to do using mod_rewrite; As a matter of fact, you must do it if you wish to use custom error pages. Otherwise, banned users can't fetch the 403-Forbidden error page, and this puts your server in a loop!

Jim

skinter

4:24 am on Jun 8, 2005 (gmt 0)

10+ Year Member



Well, here's my currect code:

<Files .htaccess>
order allow,deny
deny from all
</Files>

##########################################################

order allow,deny
deny from 166.**.185.11
allow from all

##########################################################

ErrorDocument 403 /error/403.shtml
ErrorDocument 404 /error/404.shtml
ErrorDocument 500 /error/500.shtml

Thanks for your help.

[edited by: jdMorgan at 4:58 am (utc) on June 8, 2005]
[edit reason] Obscured IP address. [/edit]

jdMorgan

4:56 am on Jun 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This unconditionally denies access to your .htaccess and .htpasswd files in all directories, denies access by any user-agent containing "larbin", and denies access from 166.**.185.11, except that everyone is allowed to access your "allowed file", plus robots.txt and your ErrorDocuments, which should never be denied (see warning above).

SetEnvIf Request_URI "\.htaccess$" block
SetEnvIf Request_URI "\.htpasswd$" block
SetEnvIf User-Agent "larbin" block
SetEnvIf Request_URI "^/path_to_allowed_file$" allow
SetEnvIf Request_URI "^/robots\.txt$" allow
SetEnvIf Request_URI "^/403\.shtml$" allow
#
Order deny,allow
Deny from 166.**.185.11
Deny from block
Allow from allow
#
ErrorDocument 403 /error/403.shtml
ErrorDocument 404 /error/404.shtml
ErrorDocument 500 /error/500.shtml

For more info, see Apache mod_access [httpd.apache.org] and mod_setenvif [httpd.apache.org].

Jim

skinter

5:14 am on Jun 8, 2005 (gmt 0)

10+ Year Member



Thank you so much Jim.