views:

2020

answers:

3

Hello all!

I have 8 lines of rewrite rules in my .htaccess file. I need to exclude two physical directories on my server from these rules, so they can become accessible. For now all requests are sent to index.php file.

Directories to exclude: "admin" and "user".

So http requests: http://www.domain.com/admin/ should not be passed to index.php file.

ErrorDocument 404 /index.php?mod=error404

Options  FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

RewriteRule ^([^/] )/([^/] )\.html$ index.php?lang=$1&mod=$2 [L]
RewriteRule ^([^/] )/$ index.php?lang=$1&mod=home [L]

Thanks for any advise!

A: 

add a condition to check for the admin directory, something like:

RewriteCond %{REQUEST_URI} !^/?(admin|user)/
RewriteRule ^([^/] )/([^/] )\.html$ index.php?lang=$1&mod=$2 [L]

RewriteCond %{REQUEST_URI} !^/?(admin|user)/
RewriteRule ^([^/] )/$ index.php?lang=$1&mod=home [L]
Rob
Hello Rob, I put this line right after "RewriteBase /", and now I am getting "500 Error - Internal Server Error"
Kelvin
@Kelvin I edited my answer, add the condition before each rule you want it to apply to.
Rob
A: 

Try this rule before your other rules:

RewriteRule ^(admin|user)($|/) - [L]

This will end the rewriting process.

Gumbo
Hello Gumbo, your code worked if user type domain.com/admin/ (with ending slash) but not without it. Do you what can be changed for both cases to work? Thanks
Kelvin
@Kelvin: The alternation `($|/)` should handle both cases.
Gumbo
A: 

rewriteCond %{REQUEST_URI} ^(ajax|css|functions|image_viewer|images|img|include|fancybox|jquery|jscript|json)$ - [L]
RewriteRule ^(.[^/])/(.[^/])/(.+[^/]) ?program=$1&usertype=$2&username=$3 [NC]

could you please help me find what is wrong in this.. ? I need to exclude some folders from url rewriting.

i tried with the solution given here.. but still i am getting some errors..

http://www.idxsync.com/sbaor/Search/Agent/zz

please help me

Aquagirl