2

I have an old website - written in asp. The contact form uses a querystring to decide which form the visitor sees.

If a vistor wishes to just contact me, they may do so by clicking the link to:

http://example.com/contact.asp

If they wish to submit a fault - they do so by clicking the following link

http://example.com/contact.asp?problem=true&.......

Additional parameters are also passed after problem nb: ?problem=true&Customer... - however, I only need to know if problem=true

In the new site I have two pages: contact.html, and help.html

When a visitor goes to contact.asp they are redirected to contact.html - thanks to the following redirect rule:

RewriteRule ^contact\.asp$ http://example.com/contact-us.html [R=301,L]

However, I am having MASSIVE problems trying to get http://example.com/contact.asp?problem=true to redirect to help.html

I've found tons of examples - but none of them work.. the page always redirects to contact.html

I have even commented out the above rewrite rule to see if my problem=true rule was being over-ridden.... This returned a 404. My problem=true rule just doesn't work.

I've been following examples such as: http://www.simonwhatley.co.uk/apache-htaccess-query-string-redirects

So to recap, I'd like to redirect contact.asp?problem=true to help.html, and contact.asp to contact.html

Many thanks in advance,

Rob

2
  • You should really consider to accept your answers (Check the 'V' mark). Otherwise people will stop giving answers to your questions. Commented May 21, 2012 at 14:19
  • Thanks - I didnt realise you had to tick things off. Took me awhile to find it. Commented May 21, 2012 at 14:58

1 Answer 1

4

Not sure what you have tried as far as matching the query string, but the following should work.

RewriteCond %{QUERY_STRING} ^problem=true
RewriteRule ^contact\.asp$ http://primarysite.net/help.html [R=301,L]

RewriteRule ^contact\.asp$ http://primarysite.net/contact-us.html [R=301,L]

Hope that helps.

Sign up to request clarification or add additional context in comments.

2 Comments

If I had a high enough reputation I'd vote you up as high as possible! Thanks! This works works exactly as required :D
Glad it worked for you! 1 vote is enough, but you can accept the answer as correct to the left of the answer :)

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.