tags:

views:

48

answers:

2

Hello,

I am writing htacess redirect rule but it is not working properly I have tried many solutions but simply it is not working.

What I want to do is to I have url http://example.com/cms/index.php?page=filename I want this url to be executed and show appropriate page but in browser it should show example.com/cms. And what is important is I only want to right this rule for this page only and it should not effect to other pages.

Thank you.

+2  A: 

RewriteRule ^([^/]+)/$ /cms/index.php?filename=$1 [L,QSA]

The L at the end says it is the last rule (stop processing) and QSA means 'Query String Append', so if someone puts other parameters after it, such as:

http://example.com/cms.htm?order=desc

The GET value for order will be passed also - without it it'll just quietly drop it.

Meep3D
+1: Your answer was a more thorough solution :-)
Jon Cage
A: 

Something like this ought to work:

RewriteEngine on
RewriteRule ^http://example.com/cms$ http://example.com/cms/index.php?page=filename

...should work.

Have a look at a tutorial with some examples if you're interested in seeing what else you can do.

Jon Cage