Server Fault is a question and answer site for system and network administrators. 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

URL rewrite Rule

my page works if the user is given URL like this


How to write rewrite rule that works on both cases



I tried like this but it is redirecting /show/(15chars) to show.php?id=(15chars)

RewriteEngine on
RewriteRule ^/show/([a-zA-Z0-9]{15})$$1

if user gives url like this means if he adds &m=true to the url


I have to redirect it to another page where html version will be available

share|improve this question
Can you add some examples of what source addresses need to be re-written to what target addresses? Your question is very unclear as it stands. – Bart B Jun 27 '12 at 10:54
up vote 1 down vote accepted

I think, that your problem we can divide to two rules:

RewriteEngine on
RewriteRule ^/show/([a-zA-Z0-9]{15})&m=true$$1 [L]
RewriteRule ^/show/([a-zA-Z0-9]{15})$$1 [L]
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.