I currently use:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
for removing .php and .html.
But I was wondering how would I rewrite ?[variableName]=[variable].
So for example, currently this happens:
http://myurl.com/about.html to http://myurl.com/about/
But how would I then rewrite variables such as:
http://myurl.com/foo/?bar=true to http://myurl.com/foo/bar/true/
or is this not possible?
Thanks for your help, any optimizations on my current rewrite is also welcome!
EDIT: Hi All, so after some help from zx, I have gotten to this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
RewriteCond %{QUERY_STRING} ([^=]+)=([^=]+)
RewriteRule ^/?$ %1/%2? [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
And I link like: href="./?do=foo" and the return is /?do=foo not /do/foo/.
Here is a pastebin to 100% of the .htaccess code, including the stuff in there which was default from the host provider: click