Reputation: 1574
I have this URL
www.example.com/index.php?key1=val1&key2=val2&key3=val3
and so on
and I want after sending my request, I see something like this in URL bar:
example.com/key1/val1/key2/val2/key3/val3
and so on.
I want to be able to use both kind of URL and always see something like the second url in URL bar.
Is it possible?
Upvotes: 1
Views: 641
Reputation: 143896
Try:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)(.*)$ /$3?$1=$2 [L,QSA]
This will change all path nodes into key/value parameters, as long as any of the keys aren't files or directories in your document root.
Upvotes: 1