1

I want to rewrite all the root folders to mysite.com/index.php?folder=^folder using Apache htaccess. However, I don't want the images folder to be rewritten. Like Facebook.

1
  • I have found the solution, thank you about your interest w3d – exarhis Oct 19 '14 at 13:14
1

I found the solution:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/subfolder
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Those rules will rewrite all the submits to index.php?q=variable

1
  • Thanks for the feedback. Just to add, if you use a relative path substitution in the RewriteRule directive (ie. index.php) you should specify a RewriteBase directive, otherwise results could be unpredictable on different servers, or break if the code was moved to another folder. Alternatively, specify a root-relative (or absolute) path. – MrWhite Oct 20 '14 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.