Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite writing

how to write a few mod_rewrite rules

         

creativevisions

5:45 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



I need some help determining how to write some rules for mod_rewrite.

I apologize for asking these questions, but I can't catch on to the mod_rewrite syntax well enough to feel confident to do this on my own.

Basically, I need to convert static URLs of the following format:

mydomain.com/item1.html
to the following:
mydomain.com/index.mv?doc=item1

in other words, the name of the html file will always become the value of the variable 'doc'.

Also, whatever variables that follow an html file, for example:
mydomain.com/item1.html?mode=ext
need to be included in the converted URL as such:
mydomain.com/index.mv?doc=item1&mode=ext

The last rule is the simplest:
mydomain.com/index.html
needs to be converted to:
mydomain.com/index.mv

So basically, I think I need only three rules. Correct?

Thank you very much in advance,

-Creative Visions

WhosAWhata

10:10 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



In the future please attempt to write the code and we will debug for you...thanks

RewriteEngine on
RewriteRule index.html index.mv [L]
RewriteRule (.*).html?(.*) index.mv?doc=$1&$2 [L]
RewriteRule (.*).html index.mv?doc=$1