Remote Web Development Job In IT And Programming

Magento Store switcher redirects based on HTTP header named “CF-IPCountry”

Find more Web Development remote jobs posted recently Worldwide

We need our Magento web store to switch stores based on CF_IPCOUNTRY which is passed into the HTTP header by Cloudflare

The way we are setup is the store ID is added to the web url

For example:

domain.com/us-en
domain.com/ca-en
domain.com/eu-en

Either this should be done in .htaccess, or PHP code in the header.

In this case it is important that only the store is switched, and no js, css or image files.

So the htaccess file needs to be setup as follows.

If country is USA - send visitor to domain.com/us-en/* (append full url)
If country is X (we will need to provide a list of country names) send visitor to domain.com/eu-en
Else, send visitor to domain.com/ca-en

We should also have the ability to exclude an IP address from this so that we can test locally.
It should also be ignored by robots and spiders.

We also tried with PHP code in the header, but this did not work. Maybe there is a different way?

<?php

$country_code = $_SERVER [HTTP_CF_IPCOUNTRY];

if ($country_code==US) {
$link = //domain.com/us/;
}
else if ($country_code==GB) {
$link = //domain.com/eu/;
}
else if ($country_code==DE) {
$link = //domain.com/eu/;
}

else {
$link = //domain.com/us/;
}

header(location:$link);
exit;
?>

Note that I will not be giving server access. I just need the code which I can upload myself. We also plan to edit ourselves when we need to add more countries to redirect.

I will pay a 50% bonus if this is solved today.
About the recuiter
Member since May 20, 2018
Gagan Gupta
from Ticino, Switzerland

Skills & Expertise Required

Magento 2 Website Development 

Open for hiringApply before - Aug 4, 2024

Work from Anywhere

40 hrs / week

Fixed Type

Remote Job

$191.41

Cost

Offer to work on this project closes in 18 days!
Are you interested in this Opportunity?

Looking for help? Checkout our video tutorial
How to search and apply for jobs

How to apply? Do you have more questions about the Job?
See frequently asked questions

Similar Projects

Shopify web developer for Handbag company

We started a custom Shopify site and need help enhancing and building the site out. We are experienced e-commerce and accessory industry veterans looking for a long term freelance relationship, part-time as we need help with the site design and growt...read more

Expert CRO Specialist Needed for Ecommerce Product Page

- Optimize specific product/landing pages to increase conversion rates

- Can run multiple A/B tests.

- Build and implement the best performing optimized page on shopify website

- Prior experience is a must. Please do not ap...read more

Looking for a Full Stack Wordpress Developer

Im looking for an experience developer who can assist with Wordpress website I have. I have plenty of work that I need help with, so Im looking for someone who can work Monday - Friday.

Please send examples of your work.

PHP Laravel Multi-Tennant eCommerce System

**NO AGENCIES**

Were currently in the design stage of this project.

We are in need of an experienced PHP Developer with good Laravel knowledge. The development wont start straight away however we want to begin speaking to develope...read more

Web Developer with Coding Experience Needed to Create Website

I am in need of a web developer to create me a website that lets customers choose audio clips and edit them into a music file that is either stored on the website in an asset pool or e-mailed to them after if they choose to purchase to own it. So th...read more