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 TechnoratiShare 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
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
You could try: RewriteRule !admin.* /index.php [L]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare 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 TechnoratiShare 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 offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 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 | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare 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 TechnoratiShare 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
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Thanks for posting your solution.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare 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 02:56 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.