m4rc0
08-09-2010, 10:03 AM
Hello !
I am a PHP intermediate programmer. But I don't know anything about htaccess.
Here is what I need :
###################
What you need to know :
1 - My members section is protected with http authentification. I use htaccess.
Here is what I need :
I have a flat file of banned usernames located in this directory :
/www/path/website/ban.dat
In my htaccess file, after the authentication, I need a conditional mod rewrite to look in the ban.dat file... If the username is in the ban.dat file, I need then the user to get redirected here : http://www.domain_name.com/ban.htm?{username}
#############################################
The nearest I got is this... But it doesn't work !
AddType application/x-httpd-php .html .htm
AddType text/html .html
Options FollowSymLinks
ErrorDocument 404 /index.htm
Order Deny,Allow
Deny from All
AuthUserFile /www/server/www.domain-name/cgi-bin/test/.htpasswd
AuthName MEMBERS
AuthType Basic
Options +Includes
AddHandler server-parsed .html
<Limit GET POST>
require valid-user
Satisfy Any
</Limit>
RewriteEngine on
RewriteCond %{IS_SUBREQ} ^false [NC]
RewriteCond %{HTTP:Authorization} ^basic [NC]
RewriteCond /www/path/website/ban.dat%{LA-U:REMOTE_USER} -f
RewriteRule (.*) http://www.domain_name.com/ban.htm?User=%{LA-U:REMOTE_USER}
I have been looking for 3 entire days now... from 8 AM to 10 PM !!!
I would really be great if you could come up with a direct solution and no hints... My goal is not to learn htaccess coding but to solve this problem !!
:p
Thanks !
Marco
P.S.: For some reasons, I need this to be in the htaccess file. I know I can code this in PHP but that is not what I need at this moment. :)
I am a PHP intermediate programmer. But I don't know anything about htaccess.
Here is what I need :
###################
What you need to know :
1 - My members section is protected with http authentification. I use htaccess.
Here is what I need :
I have a flat file of banned usernames located in this directory :
/www/path/website/ban.dat
In my htaccess file, after the authentication, I need a conditional mod rewrite to look in the ban.dat file... If the username is in the ban.dat file, I need then the user to get redirected here : http://www.domain_name.com/ban.htm?{username}
#############################################
The nearest I got is this... But it doesn't work !
AddType application/x-httpd-php .html .htm
AddType text/html .html
Options FollowSymLinks
ErrorDocument 404 /index.htm
Order Deny,Allow
Deny from All
AuthUserFile /www/server/www.domain-name/cgi-bin/test/.htpasswd
AuthName MEMBERS
AuthType Basic
Options +Includes
AddHandler server-parsed .html
<Limit GET POST>
require valid-user
Satisfy Any
</Limit>
RewriteEngine on
RewriteCond %{IS_SUBREQ} ^false [NC]
RewriteCond %{HTTP:Authorization} ^basic [NC]
RewriteCond /www/path/website/ban.dat%{LA-U:REMOTE_USER} -f
RewriteRule (.*) http://www.domain_name.com/ban.htm?User=%{LA-U:REMOTE_USER}
I have been looking for 3 entire days now... from 8 AM to 10 PM !!!
I would really be great if you could come up with a direct solution and no hints... My goal is not to learn htaccess coding but to solve this problem !!
:p
Thanks !
Marco
P.S.: For some reasons, I need this to be in the htaccess file. I know I can code this in PHP but that is not what I need at this moment. :)