Jump to content
Sign in to follow this  
Manny

htaccess RewriteRule & htpasswd Clash

Recommended Posts

I'm currently trying to build an admin CMS and in order to hide querystrings, I have used htaccess to rewrite the URLs into something a little more user friendly. The rewrites work perfectly. However, I want to use htpasswd to protect the directory from outsiders. The code I have at the moment can be found below.

AuthName "Restricted Area"AuthType BasicAuthUserFile /root/to/fileAuthGroupFile /dev/nullrequire valid-user RewriteEngine onRewriteBase /directory/ RewriteRule ^([a-z0-9-]+)/?$ index.php?query=$1 [L]RewriteRule ^([a-z0-9-]+)/([a-z0-9-]+).php$ index.php?query=$1&string=$2 [L]

When I try to use the admin section, I am being presented with this message:[an error occurred while processing this directive] If I remove the first five lines of the code, the CMS works fine, but is not password protected. If I remove everything from line 6 onwards, the htpasswd script kicks in and you are asked to log in with a username and password. What is causing the clash and how can I get the system to work as it should, but with htpasswd protection enabled?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...