I'm using the htaccess file provided with CMSMS for clean url rewriting :
Code: Select all
# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"
#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off
# (this is important, so uncomment if your host permit)
#Options -Indexes
#ServerSignature Off
#
Options +FollowSymLinks
#
<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /
#
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#RewriteCond %{REQUEST_METHOD} !POST$
#RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
As usual, I've put htaccess and htpassword files in the folder :
Code: Select all
# .htaccess
AuthUserFile "/home/mon_site/public_html/export/.htpasswd"
AuthName "Restricted access"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>
Code: Select all
<? echo realpath("index.php"); ?>
/home/saug7sp/public_html/export/.htpasswd
But when I try to access to the protected "export" folder (http://(www)mydomain/export/), I have a 404 error page !
Why

If I remove the htaccess for urlrewriting at the root, the authentification is working.
I imagine there is a conflict between the 2 htaccess, but I don't see how to resolve it, especially because it's specified in the htaccess provided with CMSMS "but only rewrites if the requested URL is not a file or directory"
I've tried to add an exception with something like :
Code: Select all
RewriteCond %{REQUEST_URI} !^/?export/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Is there a specialist of urlrewriting who could help me please ?
Thanks in advance.