Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Redirecting one url


Darklings

Recommended Posts

Hi,

 

Can someone help me to redirect one simple url? I've tried many solutions - but none has worked so far. I been trying to use .htaccess to do the job - but apparantly it only works for static url - not with dynamic one. Then i tried to 'rewrite' my 'one' dynamic link to a static link first and redirect that static link - didnt work eather.

Anyway - now i'm trying this, in php:

 

I put this at top of my index.php page:

 

	if (basename($PHP_SELF) == FILENAME_DEFAULT) {
 if (isset($_GET['cPath']) == '3') {
	 header("location: http://www.mydomain.be/anotherpage.php");
 }
}

 

 

 

I hope i get it right with my explanation here - i first check if the basename is default (index.php) then i check its cPath.. i know this works - but now comes the one thing i had to figure out myself - the cPath has to be 'cPath=3' - that is one of my categories. I want it to be redirected to /anotherpage.php.

 

With this line of code - he changes my page to /anotherpage.php whenever there a cPath - no matter what number comes behind it.

 

So, my guess is, my check to see if the cPath == 3 is not correct.

Can someone with phpknowledge help me out here?

 

Thnx,

Kind Regards,

Tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

Oh, now i feel realy dumb - sorry for posting this - i just found out how it works.

Like 5 seconds after posting and having searched the internet for two days before the post :s

 

The solution was:

 

	if (basename($PHP_SELF) == FILENAME_DEFAULT) {
 if (isset($_GET['cPath']) && ($_GET['cPath'] == "3")) {
	 header("location: http://www.mydomain.be/anotherpage.php");
 }
}

 

 

Kind Regards,

tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...