Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I sent out a link in an email that had a typo in the URL. I need to make a quick change for tracking purposes so that any incoming hits to the URL are instead parsed to another URL.

From the link sent out:


To the version I want to track:


How do I set up a RewriteRule to handle such a transformation?

share|improve this question

migrated from serverfault.com Apr 20 '11 at 4:26

This question came from our site for system and network administrators.

This works.

RewriteRule ^app/prog1.php$ /app/prog2.php [L]

share|improve this answer
  • don't forget to turn on RewriteEngine
  • more important: don't forget the QSA at the end of the RewriteRule (QSA = query string append = keep what's after the ?):

Here's what should work:

RewriteEngine On
RewriteRule /app/prog1.php$ /app/prog2.php [QSA,L]

And if you want to track it in your log, do a redirect:

RewriteEngine On
RewriteRule /app/prog1.php$ http://mywebsite/app/prog2.php [QSA,R,L]

(Not tested but it should work)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.