Reputation: 188
I'm looking to do the opposite of a common query with .htaccess files.
I want to redirect a standard url to a url with a query string, similar to below:
test.com/directory/pagename
to:
test.com/template?id=1
I don't require pattern matching of any form, I just want to write out a separate redirect for each one. For example:
test.com/colours/red = test.com/template?id=5
test.com/colours/yellow = test.com/template?id=3
Hopefully this makes some sense.
Upvotes: 0
Views: 83
Reputation: 784998
You can use this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteRule ^colours/yellow/?$ template?id=3 [L,NC,QSA]
RewriteRule ^colours/red/?$ template?id=5 [L,NC,QSA]
Upvotes: 2