shanejeffery86 Posted June 15, 2010 Share Posted June 15, 2010 Hey all. My previous post in the wrong forum explains in more detail what I am trying to achieve: http://www.phpfreaks.com/forums/index.php/topic,301173.msg1425323.html#msg1425323 I am redirecting in my PHP file like this: header("Location: wow-armory-profile/" . $profileID); exit; I need to make it so that when this location is hit, the armory.php file that I have knows that it needs to be executed. So, I need to figure out how to check at the server level if this URL is being hit and then execute my armory.php file WITHOUT rewriting the URL to the armory.php. Any ideas on how to do this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/ Share on other sites More sharing options...
cags Posted June 15, 2010 Share Posted June 15, 2010 You mean... RewriteRule ^wow-armory-profile/$ /armory.php ...? Quote Link to comment https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/#findComment-1072298 Share on other sites More sharing options...
shanejeffery86 Posted June 15, 2010 Author Share Posted June 15, 2010 I have a PHP header redirect happening in my index.php file. The code reads: header("Location: armory.php?profileID=" . $profileID); Upon that redirect, I need that URL to be rewritten to: wow-armory-profile/$profileID I cannot just simply put that rewrite in the header redirect as the redirect would not know where it is going. Any idea on how to achieve this? I am currently using this Rewrite Rule: RewriteRule ^wow-armory-profile/(.*)$ /armory.php?profileID=$1 [L], but no luck with it. Quote Link to comment https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/#findComment-1072486 Share on other sites More sharing options...
cags Posted June 16, 2010 Share Posted June 16, 2010 If you want the URL to be wow-armory-profile/blah, then you need to change the header redirect to wow-armory-profile/blah. Quote Link to comment https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/#findComment-1072952 Share on other sites More sharing options...
shanejeffery86 Posted June 20, 2010 Author Share Posted June 20, 2010 Hey Cags. So, what I am doing is this: On the header redirect, I have: header("Location: wow-armory-profile/" . $profileID); In the htaccess, I have this: RewriteRule ^wow-armory-profile/(.*)$ /armory.php?profileID=$1 [L] Still not working, but I have a feeling I am getting closer. Quote Link to comment https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/#findComment-1074514 Share on other sites More sharing options...
shanejeffery86 Posted June 20, 2010 Author Share Posted June 20, 2010 Hey Cags. I do need the URL to be that, but I also need the PHP file to fire (armory.php) as that is where all of the data is being pulled from. I think my Rewrite Rule is close, but it is still not working. So, what I am doing is this: On the header redirect, I have: header("Location: wow-armory-profile/" . $profileID); In the htaccess, I have this: RewriteRule ^wow-armory-profile/(.*)$ /armory.php?profileID=$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/#findComment-1074515 Share on other sites More sharing options...
shanejeffery86 Posted June 20, 2010 Author Share Posted June 20, 2010 Well, my God...I figured it out... My rewrite rule was being stupid. My final rule: RewriteRule ^wow-armory-profile-([^/]*)\.html$ /armory.php?profileID=$1 [L] Thanks again for the help Quote Link to comment https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/#findComment-1074517 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.