|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Below is the .htaccess file that I am having a terrible time with. To explain briefly, I have a membership site and so I need password authentication. Also, I am wanting to allow some users in if from certain IPs (in the
limit brackets). Both of the above is no problem. The problem is when I introduce the third variable of deny from OR rewrite engine to redirect certain remote addresses (password hurlers) the .htaccess file ignores the RewriteEngine towards the bottom of the file. Can anyone help? Thanks, Lisa AuthUserFile /path/to/passwords AuthGroupFile /dev/null AuthName "ENTER USER INFORMATION" require valid-user AuthType Basic <limit GET> require valid-user satisfy any order deny,allow deny from all allow from 194.96.59.0/24 allow from 195.5.107.0/24 allow from 195.132.176.0/24 allow from 195.252.60.0/24 allow from 202.159.84.0/25 allow from 210.126.142.64/26 allow from 216.50.193.0/25 </limit> RewriteEngine On Options +FollowSymlinks RewriteBase / RewriteCond %{REMOTE_ADDR} 195.23.174.185 RewriteRule /* http://www.fbi.gov [L,R] RewriteCond %{REMOTE_ADDR} 214.123.147.78 RewriteRule /* http://www.fbi.gov [L,R] RewriteCond %{REMOTE_ADDR} 64.110.64.164 RewriteRule /* http://www.fbi.gov [L,R] RewriteCond %{REMOTE_ADDR} 63.15.50.47 RewriteRule /* http://www.fbi.gov [L,R] |
|
#2
|
|||
|
|||
|
First, reorder your .htaccess:
1) Options goes first 2) Rewrite stuffs next 3) Auth stuffs last >>RewriteCond %{REMOTE_ADDR} 195.23.174.185 >>RewriteRule /* http://www.fbi.gov [L,R] Use this instead: RewriteCond %{REMOTE_ADDR} ^195.23.174.185$ RewriteRule ^(.+) http://www.fbi.gov [L,R] Don't duplicate require valid-user line Remove the limit block A rewrite of that section: ######################################## AuthUserFile /path/to/passwords AuthGroupFile /dev/null AuthName "ENTER USER INFORMATION" require valid-user AuthType Basic allow from 194.96.59.0/24 allow from 195.5.107.0/24 allow from 195.132.176.0/24 allow from 195.252.60.0/24 allow from 202.159.84.0/25 allow from 210.126.142.64/26 allow from 216.50.193.0/25 satisfy any ######################################## >>RewriteBase / This tells me your .htaccess resides in docroot dir, why are you protecting your docroot dir? |
|
#3
|
|||
|
|||
|
Thanks freebsd. I finally realized that
I was going about it all wrong. I set up the redirect in my home directory and the password authentication and limit allows inside the members directory and works like a charm. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > VERY CHALLENGING HTACCESS PUZZLE |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|