fprabel Posted March 25, 2010 Posted March 25, 2010 I have 2 osCommerce sites, one in the US (www.mysite.com) and one in the UK (uk.mysite.com) with different products, currencies, shipping modules etc. Everyday some UK visitors land on my US site and vice versa, however it is better for them (and for me) to be on the UK site if they are from the UK and to be on the US site if they are from the US. I've been tring to redirect visitors based on a drop down box located at the top of the page. The idea is to have visitors select one of 2 values: UK and Europe - or USA and Canada. I can display the drop down box with tep_draw_form() and I suspect that I have to use the tep_redirect() function to redirect visitors based on a variable $region (or similar), however I am not sure how to link the two. I've seen a contribution that redirects visitors based on their language, however that does not work for me as everything is in english. I guess I need to modify index.php as well as header.php, but could use a little guidance here. Where should the tep_redirect() call be located to become effective? Contributions or code snippets welcome. Thanks!
germ Posted March 25, 2010 Posted March 25, 2010 You could put a link in the header of the UK site: If you are in the US click here And in the header of the US site: If you are in the UK click here That uncomplicates things considerably. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
fprabel Posted March 25, 2010 Author Posted March 25, 2010 You could put a link in the header of the UK site: If you are in the US click here And in the header of the US site: If you are in the UK click here That uncomplicates things considerably.
fprabel Posted March 25, 2010 Author Posted March 25, 2010 Thank you, I think you are right! If anybody has a solution for the drop-down box + redirect, I'll take it. Meantime I am going for your simple (but efficient) solution.
MrPhil Posted March 25, 2010 Posted March 25, 2010 Are originating IP address ranges unique for US vs UK? If so, you might do redirection on IP address and HTTP_HOST in your .htaccess file for US visitors trying to access the UK site and vice-versa. It could also be done from within PHP code (header('Location: '.$other_URL);). In either case, only redirect for the main landing page (main site entry) -- leave lower level requests (anything with a Query String) alone, in case the user has overridden the IP address selection. I'd still put the US and UK links in the site header, as a backup in case the IP redirection sends some visitors to the wrong site.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.