edwardsmarkf
edwardsmarkf

Reputation: 1417

using rewriterule to ignore existing directories

i have a rather simple issue. i have a URL on several websites that looks like this:

 http://marksdomain(dot)com/Foo/Bar/Mark.php?oldParm=value1

and note that Mark.php currently resides in a directory at:

 /public_html/Foo/Bar/Mark.php

now, Mark.php?oldParm=value1 need to changed to Lori.php?oldParm=value1 using the magic of mod_rewrite. i am unable to determine to determine how Apache does this, considering the Foo & Bar directories exist.

i have tried the following:

 RewriteEngine On
 RewriteRule ^Foo/.*$  -  [PT]
 RewriteRule ^Foo$  -  [PT]
 RewriteRule ^Bar/.*$  -  [PT]
 RewriteRule ^Bar$  -  [PT]
 RewriteRule ^Foo/Bar$  -  [PT]
 RewriteRule  ^/Foo/Bar/Mark.php?oldParm=    http://marksdomain(dot)com/Foo/Bar/Lori.php?newParm= [P,QSA,L]

but it seems that i cannot seem to get Apache to move past the Foo & Bar directories. I find examples for one directory level , but not two or more

what is the best way to accomplish this?

Ideally, i would end up with the following:

 http://marksdomain(dot)com/Foo/Bar/Mark.php?oldParm=value1
   --forwards to--
 http://marksdomain(dot)com/Foo/Bar/Lori.php?oldParm=value1

--and--

 http://marksdomain(dot)com/Foo/Bar/Mark.php?NEW-Parm=value1

will work without touching mod_rewrite.

thank you all very much.

"Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo.” — Brian Moore

Upvotes: 0

Views: 47

Answers (1)

Daniel
Daniel

Reputation: 1253

I'm no mod_rewrite genius, but try

RewriteCond %{REQUEST_URI} ^/Foo/Bar/Mark.php [NC]
RewriteCond %{QUERY_STRING} ^oldParam=(.*)
RewriteRule (.*) /Foo/Bar/Lori.php

Upvotes: 1

Related Questions