Forum Moderators: phranque

Message Too Old, No Replies

Tricky mod_rewrite problem

Rewriting based on a a redirect - impossible?

         

mblair

8:59 pm on Jul 3, 2005 (gmt 0)

10+ Year Member



I'm having a devil of a time figuring out the best solution here. My situation is that I have:

http://www.example.com/foo/
....which currently is rewritten to:
http://www.example.com/index.php?var=foo

Unfortunately, I need to 301 redirect:
http://www.example.com/foo/
... to:
http://www.example.com/newfoo/ (new canononical URL)
... and then rewrite this to:
http://www.example.com/index.php?var=newfoo

It doesn't seem to me that the results of the rewrite are accessible as an environment like REQUEST_FILENAME is. I'm not quite sure where to go from here to make this work -- it seems like it should be simple but I am stumped. :-)

Any ideas would be much appreciated!

mblair

7:52 pm on Jul 5, 2005 (gmt 0)

10+ Year Member



I've been researching this all weekend and still don't have a solution. I think I'm going to need to do everything with mod_rewrite as mod_rewrite doesn't seem to be able to access any response from a Redirect.

The problem I am running into is with mod_rewrite I don't seem to be able to issue a 301 response to the browser with a seperate response to the code that is rewritten for Apache to proccess.

Anybody have any ideas? I feel like there must be some way I am overlooking to solve this but jsut don't see it :-)