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.
-
I have found the solution, thank you about your interest w3d – exarhis Oct 19 '14 at 13:14
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
-
Thanks for the feedback. Just to add, if you use a relative path substitution in the
RewriteRule
directive (ie.index.php
) you should specify aRewriteBase
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