shanejeffery86 Posted June 15, 2010 Share Posted June 15, 2010 Hey all. I currently am redirecting to another PHP file via a header redirect. Upon that header redirect, I need a rewrite to be done. How do I do this? header("Location: armory.php?profileID=" . $profileID); exit; Hits the armory page and then this rule takes affect in the .htaccess file: RewriteRule wow-armory-profile/(.*) armory.php?profileID=$1 Is it even possible to do this? If not, please let me know and as I am going to have to move around quite a lot of code to make this work correctly for rewriting. Quote Link to comment https://forums.phpfreaks.com/topic/204816-header-location-redirect-mod-rewrite/ Share on other sites More sharing options...
shanejeffery86 Posted June 15, 2010 Author Share Posted June 15, 2010 From what I am understanding, I am wanting to rewrite a redirect. Still googling like mad to see if I can find an answer Quote Link to comment https://forums.phpfreaks.com/topic/204816-header-location-redirect-mod-rewrite/#findComment-1072250 Share on other sites More sharing options...
shanejeffery86 Posted June 15, 2010 Author Share Posted June 15, 2010 Doing further research, I think I figured out a possible solution: RewriteCond %{QUERY_STRING} ^profileID=([0-9]*)$ RewriteRule wow-armory-profile/(.*) /armory.php?profileID=%1 [L] So, if we find the profileID in the condition, we execute the rewrite rule below. Quote Link to comment https://forums.phpfreaks.com/topic/204816-header-location-redirect-mod-rewrite/#findComment-1072251 Share on other sites More sharing options...
Alex Posted June 15, 2010 Share Posted June 15, 2010 Huh? If you already have that rewrite rule in effect then redirect like this: header("Location: wow-armory-profile/" . $profileID); exit; Quote Link to comment https://forums.phpfreaks.com/topic/204816-header-location-redirect-mod-rewrite/#findComment-1072253 Share on other sites More sharing options...
shanejeffery86 Posted June 15, 2010 Author Share Posted June 15, 2010 Hey Alex. The problem with that is that location does not correspond to anything. I want the armory.php to be hit when the Location you have listed is hit ("Location: wow-armory-profile/" . $profileID). How do I go about doing that? So, when I redirect to "wow-armory-profile/" . $profileID", I want the armory.php to recognize that it needs to run, but I want to keep the URL as "wow-armory-profile/" . $profileID". I painted myself into quite a corner here and having trouble getting out. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/204816-header-location-redirect-mod-rewrite/#findComment-1072254 Share on other sites More sharing options...
Alex Posted June 15, 2010 Share Posted June 15, 2010 Oh, if that's your question you should be asking over at the mod_write board. Quote Link to comment https://forums.phpfreaks.com/topic/204816-header-location-redirect-mod-rewrite/#findComment-1072257 Share on other sites More sharing options...
shanejeffery86 Posted June 15, 2010 Author Share Posted June 15, 2010 Ah my apologies. Heading over there now. Quote Link to comment https://forums.phpfreaks.com/topic/204816-header-location-redirect-mod-rewrite/#findComment-1072259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.