WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Domain Mapping
[resolved] Frontend login fails with Domain Mapping enabled (8 posts)

  1. trejder
    Member
    Posted 1 year ago #

    In brief: Domain Mapping breaks login, if blog is set to force user login before seeing blog contents.

    Domain Mapping on subdomain-type WordPress network always redirects form subdomain to mapped domain. For example, if I have one.page.com site, mapped to one.com domain, whenever I enter one.page.com URL, I'm redirected to one.com domain, if Domain Mapping plugin is enabled.

    If user has enabled (any plugin or own code) that user must be logged in in order to view frontend (blog contents) then login fails and user is all the time redirected back to login form, if Domain Plugin is activated.

    This is problably because WordPress writes login cookie for one.domain.com and this cookie is not available for one.com domain after redirection done by Domain Mapping.

    I don't know, if there is any fix for this problem, but maybe you try to read login cookie (if exists and if this is possible) from original subdomain before redirection and set the very same cookie for the domain you're about to redirect.

    Look into this question or this thread for more details.

    http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    The security features in all web browsers prohibit a server on one domain from accessing the cookie from any other domain.

    Change your settings so the user logs into the mapped domain for the admin area as well as the front end.

  3. trejder
    Member
    Posted 1 year ago #

    I'm quite new to WordPress, so I don't know about what setting you're talking about and where to change it? Can you guide me?

    Right now no matter if I use domain.network.com (subdomain URL) or domain.com (mapped domain) I'm always redirected (for login) to domain.network.com/wp-login.php, and after logging-in, your plugin is redirecting me to domain.com, which is why login fails.

    I know very well about security issue you're talking about. I just suggested, that if your plugin is doing redirection domain.network.com --> domain.com, then it should be able to read WordPress login cookie from domain.network.com before redirection, send it to domain.com as POST or sth and then, the same plugin under domain.com could check, if there is any data sent via POST, if so, then dump it to a login cookie for domain.com. But that's just my theoretical attempt to solve this problem.

  4. trejder
    Member
    Posted 1 year ago #

    Ah, I think I found it. Thanks! :]

  5. Boise777
    Member
    Posted 1 year ago #

    I am experiencing similar difficulties. Please delineate the "settings" changes that are necessary to resolve the above-described problem.
    Thank you very much.

  6. trejder
    Member
    Posted 1 year ago #

    @Boise777: First go to your Network Dashboard > Settings > Domain Mapping Configuration and make sure that you:

    a) set your server's correct IP address,

    b) checked first four (out of five) checkboxes bellow (at least this is, what I have checked).

    Then go to dashboard of each site of your network, to Tools > Domain Mapping and change Primary Domain from subdomain to your top-level domain.

    If I'm not mistaken, if you add new site to your network, by default its domain will be set to subdomain.network.com and you have to manually switch it to your top-level domain.

  7. Boise777
    Member
    Posted 1 year ago #

    Hello trejder,
    After making the above settings, all is working very well. Thank you!

  8. trejder
    Member
    Posted 1 year ago #

    Glad, I could help! :] All the best...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.