Page 1 of 1

[Solved] Problem with pretty URL and password protection

Posted: Tue Nov 06, 2007 10:14 pm
by Edi
I have installed my CMS with pretty URL. The code in .htaccess is:

Code: Select all

# Redirection
Redirect permanent /index.html http:/cms/index.php

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# Make sure you have Options FollowSymLinks
# and Allow on
RewriteEngine On
RewriteBase /cms/

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]


This works without any problems. And I can access other directories. But when I password protect a directory I cannot access it anymore (error 404, requested URL was not found on this server).

Any idea what goes wrong?

Edi

Re: Problem with pretty URL and password protection

Posted: Wed Nov 07, 2007 7:34 pm
by Pierre M.
Hello,

"password protect" -> you mean http basic/digest auth ?
If so, are your protection rules before your rewrite rules ?

What are in your http logS and rewritelog ?

Is the folder your want to protect under /cms/ or elsewhere ?

Pierre M.

Re: Problem with pretty URL and password protection

Posted: Wed Nov 07, 2007 8:56 pm
by kermit
sounds like the same problem I described here:

http://forum.cmsmadesimple.org/index.ph ... 938.0.html

turned out to be nothing to do with cmsms or mod_rewrite; but with the lack of having custom error documents in the domain root.. the 404 was caused by a missing one; not a 'missing' requested url.

add them and see what happens..

for reference; i added all the usual ones; 400.shtml, 401.shtml, 403.shtml, 404.shtml, and 500.shtml - cpanel (the cp on that particular server) has a facility to add/edit custom error documents -- other cp's (like hsphere) do as well.

Re: Problem with pretty URL and password protection

Posted: Wed Nov 07, 2007 10:18 pm
by Edi
Thank you all! Reading your posts I realized what I have made wrong...

The .htaccess file was placed in the root directory. Now I split it in two files.

This file is placed in the root directory:

Code: Select all

# Redirection
Redirect permanent /index.html http:/cms/index.php
This one in the directory /cms:

Code: Select all

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# Make sure you have Options FollowSymLinks
# and Allow on
RewriteEngine On
RewriteBase /cms/

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
And it works!