Credit Card Consolidation - Property Search - Credit Cards - Buy WoW Gold - Loans

PDA

View Full Version : Need some quick help with a htaccess redirect


vetting
Dec 28th 2007, 5:57 pm
Ok, I have the following link

http://www.subdomain.mysite.com/?itemID=65165654654

I need to redirect it through another site.

http://www.othersite.com/65165654654?refid=store
So I need to drop the ?itemID= and add another tag at the end.

I tried to get it to work but just couldn't get all of the parameters right. Thank you in advance for your help.

hanji
Dec 28th 2007, 11:58 pm
I'm not sure if you'll be able to do that with redirect in .htaccess... but you could do something like this with rewrite and a PHP page.

.htaccess...
RewriteEngine On
RewriteRule ?itemID=([0-9]+) go.php?itemID=$1 [QSA,L]
So this will look for itemID in the url, and redirect to a php page, called go.php
This php page would then take the variable and then redirect via header().

go.php
<?
if(isset($_GET['itemID'])){
header("Location:http://www.othersite.com/".$_GET['itemID']."?refid=store");exit();
}
?>

Seems like another option is to use the default PHP page and handle redirect on itemID condition. I'm assuming this is index.php?itemID=65165654654, in that case you could add 'go.php' snippet to that page, and scrap the rewrite handling all together. I might be misunderstanding.. so correct me if I'm wrong.

hanji