We are currently running Magento 1.9.0.1 CE for our online store. We have a domain example.com and a subdomain in.example.com
We use in.example.com specifically for customers from India whereas everybody else is meant for example.com. We are currently using geoip database to redirect. The issues that we are facing are as follows -
if somebody from India opens example.com/page.html they get redirected to in.example.com instead of in.example.com/page.html
if somebody from USA opens in.example.com they are not getting redirected to example.com at all. same is also true for in.example.com/page.html
even with these redirects we want example.com/admin to not get redirected whether accessing from India or USA.
Code that I have used is as follows -
RewriteCond %{HTTP_HOST} .*in.mokshafashions\.com [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:india]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]
RewriteCond %{HTTP_HOST} ^mokshafashions.com [NC]
RewriteRule ^(.*)$ in.mokshafashions.com/$1 [R=301,L]
RewriteRule ^(.*)$ mokshafashions.com/$1$1 [L]
RewriteCond %{REQUEST_URI} !^/admin.* – –