Current location: Hot Scripts Forums » Other Discussions » Web Servers » conflict between RewriteRule and AuthType Basic

conflict between RewriteRule and AuthType Basic

Reply
  #1 (permalink)  
Old 11-08-09, 05:59 PM
m_abdelfattah m_abdelfattah is offline
Newbie Coder
 
Join Date: Sep 2004
Location: Alexandria, Egypt.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
conflict between RewriteRule and AuthType Basic

I've 2 .htaccess files, one on the root , and here's the content :
Code:
Options +FollowSymLinks
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
and the other one on "/admin/", and here's the content :
Code:
AuthType Basic
AuthName "Administrator Control Panel"
AuthUserFile "./passwd"
require valid-user
when I visit : http://www.domain.com/admin/
it redirect me to /index.php
and not showing the authentication window !!

when I delete 2nd file which in "/admin/" , I can access http://www.domain.com/admin/
and If I deleted 1st file, the authentication window on http://www.domain.com/admin/ appears !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-09-09, 05:17 PM
wirehopper's Avatar
wirehopper wirehopper is offline
Community Liaison
 
Join Date: Feb 2006
Posts: 1,540
Thanks: 1
Thanked 22 Times in 22 Posts
You could try: RewriteRule !admin.* /index.php [L]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-09-09, 05:22 PM
m_abdelfattah m_abdelfattah is offline
Newbie Coder
 
Join Date: Sep 2004
Location: Alexandria, Egypt.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks a lot for your reply, but it doesn't work !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-09-09, 06:06 PM
End User's Avatar
End User End User is online now
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 2,824
Thanks: 13
Thanked 10 Times in 9 Posts
Quote:
Originally Posted by m_abdelfattah View Post
Thanks a lot for your reply, but it doesn't work !
I'm not sure, but I think that RewriteCond with -d doesn't find (trigger on) protected directories.

The "RewriteCond %{REQUEST_FILENAME} !-f" means that if the request is for a file that exists on the server, index.php isn't served. It's possible that the two sets of .htaccess rules are clashing because of these conditions.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data (scroll down)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-09-09, 06:29 PM
m_abdelfattah m_abdelfattah is offline
Newbie Coder
 
Join Date: Sep 2004
Location: Alexandria, Egypt.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Ohh, after 2 days of searching, I finally find the solution , just add :
Code:
ErrorDocument 401 default
to either of the 2 .htaccess

I found the solution here :
Wordpress and .htaccess Password Protected Directories Andrew Rollins
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-09-09, 06:49 PM
wirehopper's Avatar
wirehopper wirehopper is offline
Community Liaison
 
Join Date: Feb 2006
Posts: 1,540
Thanks: 1
Thanked 22 Times in 22 Posts
Thanks for posting your solution.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Forum Jump


All times are GMT -5. The time now is 09:10 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.