sinisa Posted October 14, 2006 Share Posted October 14, 2006 HiI have auction script that I am working on, and I need some help with redirection.I would like to redirect page like www.mydomain.com/item.php?id=12345 to www.mydomain/NEWDIRECTORI/item.php?id=12345(Note that item.php?id=12345 is a some item that has been listed on that auction)I did try to use .access file but I can not get it to work on individual item redirection it only works to redirect item.php and than redirects all items listed on auction to new directory not just one item that I want to redirect.Thanks [email protected] Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/ Share on other sites More sharing options...
dymon Posted October 14, 2006 Share Posted October 14, 2006 You can try to use a redirection like this:header ("LOCATION: NEWDIRECTORI/item.php?id=12345");If I remember right you can not use a full URL(www.mydomain/NEWDIRECTORI/item.php?id=12345), in security reason. Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108769 Share on other sites More sharing options...
sinisa Posted October 14, 2006 Author Share Posted October 14, 2006 [quote author=dymon link=topic=111481.msg451831#msg451831 date=1160828018]You can try to use a redirection like this:header ("LOCATION: NEWDIRECTORI/item.php?id=12345");If I remember right you can not use a full URL(www.mydomain/NEWDIRECTORI/item.php?id=12345), in security reason.[/quote] Where do I insert this in what page?Thanks Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108771 Share on other sites More sharing options...
joshi_v Posted October 14, 2006 Share Posted October 14, 2006 Include this line after the code , from where you want to redirect the file. Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108772 Share on other sites More sharing options...
dymon Posted October 14, 2006 Share Posted October 14, 2006 You should use this before any printing functions like: print, echo. Otherwise you willl get an error saying that the headers allready sent.You could provide a piece of code where you want this redirection Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108774 Share on other sites More sharing options...
sinisa Posted October 14, 2006 Author Share Posted October 14, 2006 [quote author=dymon link=topic=111481.msg451836#msg451836 date=1160829330]You should use this before any printing functions like: print, echo. Otherwise you willl get an error saying that the headers allready sent.You could provide a piece of code where you want this redirection[/quote]Hi thanks for the reply sThe real url of the page is http://ebajba.com/item.php?id=61d1e471ff8cf866a17a188ef5293a23 but I need this page redirected to http://www.ebajba.com/phonauct/item.php?id=61d1e471ff8cf866a17a188ef5293a23Which page would you like me to send the code from?Thanks Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108775 Share on other sites More sharing options...
dymon Posted October 14, 2006 Share Posted October 14, 2006 Did I understand ritght, you want this redirection from the PHP file or from somewhere else?If from the file than provide the code for the first url (http://ebajba.com/item.php?id=61d1e471ff8cf866a17a188ef5293a23), and indicate where the redirection should be.Or you want just a simple redirection, like if someone enters here url (http://ebajba.com/item.php?id=61d1e471ff8cf866a17a188ef5293a23), automaticaly to be redirected here url(http://www.ebajba.com/phonauct/item.php?id=61d1e471ff8cf866a17a188ef5293a23)? If so just live the page item.php empty, just write in it:header ("LOCATION: NEWDIRECTORI/item.php?id={$_GET['id']}"); And this should work. Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108776 Share on other sites More sharing options...
sinisa Posted October 14, 2006 Author Share Posted October 14, 2006 [quote author=dymon link=topic=111481.msg451838#msg451838 date=1160830161]Did I understand ritght, you want this redirection from the PHP file or from somewhere else?If from the file than provide the code for the first url (http://ebajba.com/item.php?id=61d1e471ff8cf866a17a188ef5293a23), and indicate where the redirection should be.Or you want just a simple redirection, like if someone enters here url (http://ebajba.com/item.php?id=61d1e471ff8cf866a17a188ef5293a23), automaticaly to be redirected here url(http://www.ebajba.com/phonauct/item.php?id=61d1e471ff8cf866a17a188ef5293a23)? If so just live the page item.php empty, just write in it:header ("LOCATION: NEWDIRECTORI/item.php?id={$_GET['id']}"); And this should work.[/quote]I need that simple redirection but I can not live it empty, as there is only one item.php file and the id?=12345 (I get once I create new auction)Please note that is one item that is listed in two different directories but it comes from one DB but difference between those directories is in (template_item_php.html file) as on firestone users can bet on item for free but on second one it is not for free Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108779 Share on other sites More sharing options...
dymon Posted October 15, 2006 Share Posted October 15, 2006 I am a bit confused on what you want to do. Try to explain with more details and some examples, because I don't understand where you want this redirection. Try the code I wrote you in a blank page and see how it works and if it can help you.Regards Dymon Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-108977 Share on other sites More sharing options...
sinisa Posted October 15, 2006 Author Share Posted October 15, 2006 [quote author=dymon link=topic=111481.msg452042#msg452042 date=1160894731]I am a bit confused on what you want to do. Try to explain with more details and some examples, because I don't understand where you want this redirection. Try the code I wrote you in a blank page and see how it works and if it can help you.Regards Dymon[/quote]Hi, it is bit confusing but here I will try to explainI have auction web site www.ebajba.com but also I have created new directory www.ebajba.com/phonauct Now both of those sites have the same users, files, settings, itc… as the second site is just a copy of the first one and both sites are based on one DB directory. Now in second site I have created some modifications in the template_item_php.html file so when users try to bet on item they will have to pay for it as on the first one this function is for free. But none of these users do not know that second page exists. The thing that I want to do is that on some auctions on my first site I can set redirection so when user clicks on some item auction so that he can see its description I would like to redirect him to that the same item but on second page so if he wants to place bet on it he would first have to pay. So my problem is how to set up redirection of some item description page to its description on second site. I did try htacces file but it is not functioning for some reasonMy htaccess file is: RewriteEngine on Redirect item.php?id=dbc3cf805a08599972f031e6a7f21a95 http://www.ebajba.com/phonauct/item.php?id=dbc3cf805a08599972f031e6a7f21a95RegardsSinisa Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-109073 Share on other sites More sharing options...
dymon Posted October 15, 2006 Share Posted October 15, 2006 Hi,you could use JavaScript for this:[code]<a href="#" onClick="location.href='http://www.ebajba.com/phonauct/item.php?id=dbc3cf805a08599972f031e6a7f21a95'">The item you need</a>[/code]try to use this and write the results. Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-109096 Share on other sites More sharing options...
sinisa Posted October 15, 2006 Author Share Posted October 15, 2006 [quote author=dymon link=topic=111481.msg452163#msg452163 date=1160933916]Hi,you could use JavaScript for this:[code]<a href="#" onClick="location.href='http://www.ebajba.com/phonauct/item.php?id=dbc3cf805a08599972f031e6a7f21a95'">The item you need</a>[/code]try to use this and write the results.[/quote]HiI can not insert this script anywhere as the title of the auction or (The item you need) and its hyperlink is created automatically when user creates new auction and this link appears on many pages when users browse the site, I need something like htaccess that will work for redirection of that link no meter from which page users click on this linkThank you Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-109118 Share on other sites More sharing options...
sinisa Posted October 16, 2006 Author Share Posted October 16, 2006 [quote author=sinisa link=topic=111481.msg452185#msg452185 date=1160937474][quote author=dymon link=topic=111481.msg452163#msg452163 date=1160933916]Hi,you could use JavaScript for this:[code]<a href="#" onClick="location.href='http://www.ebajba.com/phonauct/item.php?id=dbc3cf805a08599972f031e6a7f21a95'">The item you need</a>[/code]try to use this and write the results.[/quote]HiI can not insert this script anywhere as the title of the auction or (The item you need) and its hyperlink is created automatically when user creates new auction and this link appears on many pages when users browse the site, I need something like htaccess that will work for redirection of that link no meter from which page users click on this linkThank you[/quote]ANY IDEAS PLEASEEEEEE? :'( Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-109229 Share on other sites More sharing options...
joshi_v Posted October 16, 2006 Share Posted October 16, 2006 Hello,Can u post a piece of code of u r first file and the second file name.So that any one could understand what u r trying to do.Regards,Joshi. Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-109401 Share on other sites More sharing options...
redarrow Posted October 16, 2006 Share Posted October 16, 2006 There you go that easy ok.[code]<?phpheader("location: www.mydomain.com/item.php?id=$id");?>[/code] Link to comment https://forums.phpfreaks.com/topic/23931-redirection-problem-php-need-some-help-pls/#findComment-109407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.