Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

URL rewrite Rule

my page works if the user is given URL like this

show.php?id=(15chars)

How to write rewrite rule that works on both cases

/show/(15chars)

show.php?id=(15chars)

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

RewriteEngine on
RewriteRule ^/show/([a-zA-Z0-9]{15})$ http://site.com/show.php?id=$1

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

show/(15chars)&m=true

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

html/show.php?id=(15chars)
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

1 Answer 1

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$ http://site.com/html/show.php?id=$1 [L]
RewriteRule ^/show/([a-zA-Z0-9]{15})$ http://site.com/show.php?id=$1 [L]
share|improve this answer

Your Answer

 
discard

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.