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.
You can just add another
RewriteConddirective after the one you have now that will exclude the admin directory.That will prevent your
RewriteRulefrom being applied if theRewriteCondmatches 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.