mydomain.com redirect to mydomain.com/store for Magento store -
i have domain landing page want rid of. landing page (mydomain.com) links blog , magento store (mydomain.com/store) want domain link directly magento store.
i set redirect using hosting company's domain redirect tool on mydomain.com mydomain.com/store, results in redirect loop mydomain.com/store/store/store/store etc.
should setting redirect anyway? makes more sense me set magento storefront mydomain.com , rid of /store on every page within store.
first need add jquery core library , jquery cookies library on wordpress site. jquery library: http://jquery.com/download/ jquery cookie library: https://github.com/carhartl/jquery-cookie
then, please below jquery code in header.php file.
var redirectstore = jquery.cookie("redirect"); if(redirectstore!="yes") { jquery.cookie("redirect", "yes",{path:'/'}); window.location= "http://www.mydomain.com/store"; }
first checking "redirect" cookies created or not. first time user system not have cookie. redirect mydomain.com/store , created cookie. if use again come blog site while visiting store found "redirect" cookie , not stuck loop.
hope help!
Comments
Post a Comment