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
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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.