views:

130

answers:

1

Problem: I'd like to accept the original request. Say its, /IWantToGoHere/index.php but I want to return to the browser, /GoHere/index.php

To be clear:
I actually want to send the original request location down to the script requested, however, I want to return the user a browser URL to another destination.

Code:

RewriteEngine on
RewriteRule ^(.*)IWantToGoHere\/\.php$  GoHere/index.php [NC,C]
RewriteRule ^GoHere/index.php$ GoHere/index.php [R,NC]

Notes: I realize the code above doesn't work. I've tried a number of different calls. I spent umpteen hours yesterday trying every clever solution I could pull out of my limited mod_rewrite knowledge bank. Based on my understanding of mod_rewrite, I don't think it's do able. I understand its not what the preprocessed was designed to do. At least not from anything I could find on the Apache web site. I've been told that if I could dream it up, that it could be done:) I was wondering if anyone had and ideas how to get it to work.

Why would you want to do that?: Because I do. No really, I want the URL returned to the user for further processing.

weez

+2  A: 

If I understand the question correctly, to accomplish this you'll need to send a header from /IWantToGoHere/index.php that redirects to /GoHere/index.php once the script is finished executing. That is, if you want Apache to still call IWantToGoHere but return to GoHere. So at the end of processing for IWantToGoHere script something like this:

header('Location: /GoHere/Index.php');

Which will redirect correctly.

pygorex1
pyborex1: Yeah, I think you follow where I'm going with this. Hmm... I didn't think about that. I suppose as long as my controller (I'm using a MVC pattern) has sent any output headers, that might possibly work. Lemme give it a shot. Thanks for the idea.
weezy
Good thing controllers aren't views, so shouldn't ever output any content.
Matchu