doutan4831 2014-12-03 09:20
浏览 49
已采纳

重写woocommerce我的帐户,登录并注册url到子域名

I have a wordpress site with woocommerce installed on it. I want to rewrite its login, register and my account urls to subdomains.

E.g.
main site: example.com
login url: account.example.com/login
register url: account.example.com/register
my account url: account.example.com/my_account

I have mapped the subdomain and currently these urls are working fine but I am facing two issues:

  1. I am unable to change the default urls
  2. Cookies on main domain are not working on subdomain
  • 写回答

1条回答 默认 最新

  • dongzhouzhang8696 2014-12-05 06:00
    关注

    For cookies I added following in my wp-config.php and it worked like a charm:

    define('COOKIEPATH', '/');
    define('COOKIE_DOMAIN', 'lootlo.pk');
    

    For urls issue after lots of searching and not getting any proper solution I changed the urls in my themes header file and also added a 301 redirection code to redirect to subdomain if any of these urls accessed without subdomain.

    I also added a code for redirecting other urls to main domain if accessed through subdomain.

    I do not think its a proper solution but it is serving my purpose.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?