Forum Moderators: phranque
1. http://a.com/foo/bar
2. http://a.com/index.php?url=foo/bar RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
#tricky part
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\?url=?(.*)\ HTTP/ RewriteRule ^index.php$ http://a.com/$1 [R=301,L] ^index.php$ to ^(index\.php)?$ so that requests for http://example.com/?url=foo/bar are also redirected.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?url=(.*)\ HTTP/
RewriteRule ^(index\.php)?$ http://example.com/%1? [R=301,L]