Chained address rewrite

Posted by kemp on Stack Overflow See other posts from Stack Overflow or by kemp
Published on 2010-03-13T14:39:55Z Indexed on 2010/03/13 15:45 UTC
Read the original article Hit count: 445

What I need to do is rewriting this address:

(1) http://localhost/wordpress/fake/text-value

to

(2) http://localhost/wordpress/gallery?somevar=text-value

Notes:

  • the remapping must be transparent: the user always has to see address (1)
  • gallery is a permalink to a wordpress page, not a real address

I basically need to rewrite the address first (to modify it) and then feed it back to mod rewrite again (to let wordpress parse it its own way).

Problems

if I simply do

RewriteRule ^fake$ http://localhost/wordpress/gallery [L]

it works but the address in the browser changes, which is no good, if I do

RewriteRule ^fake$ /wordpress/gallery [L]

I get a 404. I tried different flags instead of [L] but to no avail. How can I get this to work?

© Stack Overflow or respective owner

Related posts about mod-rewrite

Related posts about Wordpress