.htaccess tutorial

htaccess Elite


.htaccss conflict

Ask your mod_rewrite and Redirection questions here, and get answers!

.htaccss conflict

New postby apexdivision » 26 Feb 2009 13:08

Hello All,

I need help on a critical .htaccess where I am stuck badly.
this is folder structure:
/home/site1/public_html/ >> main site hosted here which can be viewed by http://www.domain.com
we wanted to redirect in this way:
http://www.domain.com/user1?ad=google >> http://www.domain.com/index.php?id=user1&ad=google
so we put the .htaccess file at /home/site1/public_html/ as below:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?id=$1 [QSA,R]
</IfModule>

This works fine.

Now we have amember here:
/home/site1/public_html/amember
amember user folder gets created here:
/home/site1/public_html/amember/user1
there is an admin folder inside the users amember folder, that is here:
/home/site1/public_html/amember/user1/admin
We need that folder to be password protected, so we have second .htaccess file in /home/site1/public_html/amember/user1/admin and the content is:

AuthUserFile /home/site1/public_html/amember/user1/admin/.htpasswd
AuthType Basic
AuthName "Secret Place"
<LIMIT GET POST>
require valid-user
</LIMIT>

Now the problem is first .htaccess in root works fine, and it redirects properly.
If we go to http://www.domain.com/amember/user1 we see the folder listing, but when we click on 'admin' folder, that is try to access http://www.domain.com/amember/user1/admin we are taken back to http://www.domain.com/index.php
The .htpasswd works fine when we disable the outer .htaccess (first one)

We have to secure the admin folder anyhow.

Any help / direction will be highly appreciated.

Thank you in advance.
Best Regards
Nir Banerjee
For Apex Division
apexdivision
 
Posts: 1
Joined: 26 Feb 2009 12:48

Return to Redirect or Rewrite Questions