Reputation: 113
I'm trying to make a prettyurl like from: example.com/index.php?key=test&lang=eng to example.com/test/eng
I've searched a lot of code samples on the net but I can't seem to make it work. This is what I'm working on right now.
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\$ index.php?key=$1&lang=$2 [L]
Upvotes: 1
Views: 31
Reputation: 143856
You don't want to escape the $
symbol. Try:
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /+index\.php\?key=([^&]+)&lang=([^&\ ]+)
RewriteRUle ^ /%1/%2? [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)/?$ index.php?key=$1&lang=$2 [L,QSA]
Upvotes: 1