Jump to content

Header Location Redirect + Mod Rewrite


Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/204821-header-location-redirect-mod-rewrite/
Share on other sites

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.

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.

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.