Reputation: 107
Is there a way to change a url with multiple variables, for example this url:
index.php?p=place&c=Munich
to:
/place/munich
with .htaccess?
Upvotes: 1
Views: 87
Reputation: 784998
You can use this rule in root .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?p=$1&c=$2 [L,QSA]
Upvotes: 2
Reputation: 2272
Depending on what characters those two parameters contain, here's one for only letters (a-zA-Z):
RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)$ index.php?p=$1&c=$2
Upvotes: 1