Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Need some help with a .htaccess rewrite rule

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36205

    So, I’m using mod_geoip for my ecommerce site to redirect customers from Australia to a different storefront on the same server. The store is located at root/store/ and I want them to be redirected to root/austore/

    I’ve got it so the basic rewrite works flawlessly, but I want the url structure to be the same. For example, if someone clicks on a link that is root/store/category/product/ and they live overseas, I want them to be redirected to root/austore/category/product/ because the file structure is the same for both stores. As it is right now, if they click on that link, it will redirect them to just the basic root/austore/.

    Here is the rewrite rule as it is right now.

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AU$
    RewriteRule ^([^/]+)$ /austore/ [L]

    The .htaccess file I’m editing is in the store/ directory.

    Any help would be greatly appreciated. Thanks!

    Allan

    #95715

    Figured out the answer if anyone needs to do something similar:

    #if they live overseas i.e not Australia
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^AU$
    #if someone clicks on a link that is root/store/category/product/
    RewriteCond %{REQUEST_URI} ^/store(/.*)$ [NC]
    #I want them to be redirected to root/austore/category/product/
    RewriteRule ^ /austore%1 [L,R]

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Other’ is closed to new topics and replies.