1

I have troubles redirecting query strings and I really can't find a way how to do it. Let me be more specific: I want to achieve the following: Redirect http://blablabla.com/default.asp?Kategori=1&Valg=77 to: http://blablabla.com/default_Kategori_1_Valg_77.html

Any help will be very appreciated. Kind Regards, Pavel Nikolaev

2 Answers 2

1

This should work :

RewriteEngine on
RewriteCond %{QUERY_STRING} ^Kategori=1&Valg=77$ [NC]
RewriteRule ^default\.asp$ http://blablabla.com/default_Kategori_1_Valg_77.html? [L,R]
Sign up to request clarification or add additional context in comments.

1 Comment

Works smoothly! Thank you!
1

I would like to provide a new version of what starkeen advised me:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^Kategori=(.*)&Valg=(.*)$ [NC]
RewriteRule ^default\.asp$ http://blablabla.com/default_Kategori_%1_Valg_%2.html? [L,R]

The difference is that know I am catching the values of the Kategori and Valg parameters and use them in the new URL. Really interesting! Thank you all.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.