Répás
Répás

Reputation: 1820

URL Rewrite problem. (Many directory)

I'd like to make a htaccess file, which can make a good structure for my websites.

My .htaccess is now:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_URI} !/admin
RewriteRule ^(.*)$ index.php?q=$1 [QSA]

(based on Sombat's comment, and about 30 try :P)

And I want to make this, with it:

for every elements but (jpg|jpeg|gif|png|css|js|pl|txt)

if domain.xx/admin redirect to the domain.xx/admin directory and don't make a rewrite at all i mean: let me use domain.xx/admin/index.php?asd=1&asdd=2

else rewrite everything as rule one, to index.php.

Thanks for the help.

Upvotes: 1

Views: 162

Answers (1)

zombat
zombat

Reputation: 94157

You can just add another RewriteCond directive after the one you have now that will exclude the admin directory.

RewriteCond %{REQUEST_URI} !^/admin/.*

That will prevent your RewriteRule from being applied if the RewriteCond matches your admin path. The order of RewriteCond and RewriteRule directives is important, so be sure to put it before the RewriteRule that you want it to affect.

Upvotes: 1

Related Questions