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 Mar 14, 2020
Ovan Fathurrohm
from Quebec, Canada

Skills & Expertise Required

Magento 2 Website Development 

Open for hiringApply before - Jul 26, 2024

Work from Anywhere

40 hrs / week

Fixed Type

Remote Job

$191.57

Cost

Offer to work on this project closes in 21 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

App Developer

Looking for a web developer willing to start a new adventure in a social media world. Proven skills needed with past projects.
As budget is short must be willing to partner. This will be a very successful project.

Convert the Php to Wordpress

Looking to convert current php website
Its a big site 5000 pages
Looking for a brand new home page lay out
Convert all inner pages
Keep the current structure
Keep the current ranking
Mobile version as well

Seeking an expert Website Wordpress migration

Looking for an website developer expert help me to re-create the same website already have in another platform.

Requirement, Re-Build and re-design and changing adding new features and make more flexible.

If you already had done s...read more

Full Stack Development

Im searching for an efficient web developer who is familiar with php, wordpress etc and can build websites from scratch with a design & ui knowledge. You have to be able to deliver in a timely manner and be fluent in communication and understanding...read more

Online Window Configurator for clients

We are searching for someone that can replicate our app

Online window configurator. A system like that should be implemented onto a running wordpress/woocommerce site. The customer should run through the configuration and receive a quote. (t...read more