excluding directory doesn't work

Discuss practical ways rearrange URLs using mod_rewrite.

excluding directory doesn't work

Postby ropox » Tue Oct 07, 2008 12:21 am

Hello everybody,

I'm relatively new to mod_rewrite but not totally new.

i have this situation which is strange or i'm missing something out.

on my site i have the following on my .htaccess file

Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php


What this does you know. I have one directory e.g.
http://www.mysite.com/cms/ which i cant seem to access cause everytime i hit this url i get the front page again.

So i put this on my .htaccess file under my root to correct the problem

Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_URI} !/cms/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php


in order to exclude it., but it doesn't seem to work.
All i want is to display normally everything under this cms directory ...
I have tried different patterns but nothing...

Does anyone have any idea how I can do this ?

thank you guys so much in advance...
ropox
 
Posts: 2
Joined: Tue Oct 07, 2008 12:08 am

found what caused it

Postby ropox » Tue Oct 07, 2008 11:19 am

ok found why i couldnt exclude the directory on my .htaccess file.

the directory that i wanted excluded from the rewrite rules was password protected with another htacess file. as soon as i removed that I could access the scpecific directory without showing me the front page.

now i have to figure out how to protect that directory in some other way
ropox
 
Posts: 2
Joined: Tue Oct 07, 2008 12:08 am

Postby richardk » Tue Oct 07, 2008 11:19 am

You want it to match the first rule
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/cms(/.*)?$ [NC,OR]
RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule . - [PT,L]

RewriteRule .* /index.php [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 10 guests

cron