
Assistance configuring htaccess rule for Geo redirect, excluding some URL/user-agents
- or -
Post a project like this2637
$20
- Posted:
- Proposals: 2
- Remote
- #1761384
- Awarded
Description
Experience Level: Intermediate
General information for the website: Ecommerce store
Kind of development: Customization of existing website
Description of requirements/features: I currently use the config below to redirect users accessing my site from US|CA to my us. subdomain. I am wanting to amend this to achieve the below
1. exclude any urls including /affiliate-area/ from being redirected ( regardless of country)
2. exclude all search bots from being redirected
3. exclude any URLs with including ?noredirect=true
* CURRENT REDIRECT CONFIG, WORKING *
# Set the CF-IPCountry header value as "Country" variable
SetEnvIf CF-IPCountry "(.*)$" Country=$1
# Than redirect it if the variable match. "US" for USA
RewriteCond %{ENV:Country} (US|CA)
RewriteRule ^(.*)$ http://us.mysite.com/$1 [R,L]
I added in the following code but it does not appear to be working correctly to exclude affiliate-area from being redirected.
RewriteCond %{REQUEST_URI} !^/affiliate-area/$ [NC]
For somebody that knows htaccess scripts this will only take a few minutes to resolve. Please dont send me crazy quotes.
Specific technologies required: htaccess apache nginx web hosting
Extra notes:
Kind of development: Customization of existing website
Description of requirements/features: I currently use the config below to redirect users accessing my site from US|CA to my us. subdomain. I am wanting to amend this to achieve the below
1. exclude any urls including /affiliate-area/ from being redirected ( regardless of country)
2. exclude all search bots from being redirected
3. exclude any URLs with including ?noredirect=true
* CURRENT REDIRECT CONFIG, WORKING *
# Set the CF-IPCountry header value as "Country" variable
SetEnvIf CF-IPCountry "(.*)$" Country=$1
# Than redirect it if the variable match. "US" for USA
RewriteCond %{ENV:Country} (US|CA)
RewriteRule ^(.*)$ http://us.mysite.com/$1 [R,L]
I added in the following code but it does not appear to be working correctly to exclude affiliate-area from being redirected.
RewriteCond %{REQUEST_URI} !^/affiliate-area/$ [NC]
For somebody that knows htaccess scripts this will only take a few minutes to resolve. Please dont send me crazy quotes.
Specific technologies required: htaccess apache nginx web hosting
Extra notes:

Lindell H.
100% (14)Projects Completed
16
Freelancers worked with
17
Projects awarded
68%
Last project
9 Feb 2020
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies