htpasswd/ htaccess in subdir, conflicting with sef advanced htaccess in root

17 years 3 months ago #809 by deejay
Hi,

I have joomla/ sef advanced installed with an oscommerce installation in the directory webshop.

when i try to install a username/ password in the admin directory (using htaccess/ htpasswd), it is in conflict with the .htaccess that resides in the root of joomla, made by sef advance.

I know this because when i delete the .htaccess of SEF advanced, the htpasswd/ htaccess in the directory /webshop/admin/ works Perfectly.

So something in these lines is also applied on all subdirectories, probably the last line;

#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

How can i prevent SEF from url rewriting in the webshop directory so i can use htpasswd properly ???? If i am correct the above code says to exclude real directories but it prevents (/conflicts with) the following htaccess code in subdirectories (in my case the webshop/admin/ dir);

AuthUserFile /home/lifeline/domains/lifeline.ipxl.nl/public_html/webshop/admin/.htpasswd
AuthGroupFile /dev/null
AuthName "test Secret Section"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>

The problem is also explained here;
forum.joomla.org/index.php/topic,30653.0.html

Rgds, DJ

Please Log in or Create an account to join the conversation.

16 years 4 weeks ago #3190 by wwtn
DJ,

Here's the solution to your problem...


See this as a reference to suggested fix:

http://forum.joomla.org/viewtopic.php?t=31813


Find this line of code in root .htaccess file:
RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$


Replace the line of code above with the following:
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|#.*|\?.*|/[^.]*)$  [NC]


The final code modification in the root .htaccess file should look like this:
#  RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
#  RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|#.*|\?.*|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php


That will fix the problem with .htaccess and .htpasswd password protected directories falsely returning 404 server errors when Joomla v1.0.15 is SEF enabled along with SEF Advance installed and enabled.

Hope this helps you and others fix this problem.

Jim Sheridan
Worldwide TeleNet

http://www.wwtndesign.com
http://www.wwtnhosting.com
http://www.wwtndomains.com

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch