• alexlii

    (@alexlii)


    Here is a quick tip — you don’t need to use a domain mapping plugin to have a WordPress Multisite with top-level domains and/or sudomains. WordPress allows you to change a sub-domain to a top level domain once you have added the site:

    WordPress Multisite Top Level Domain Support

    The only important thing is to set the COOKIE_DOMAIN to something empty an empty string in your wp-config.php:

    define(‘COOKIE_DOMAIN’, ”);

    otherwise WordPress will always set it to your network’s $current_site->domain and you won’t be able to login into any of the other sites.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter alexlii

    (@alexlii)

    See most of what it does is that pretty interface to say “Pull domain.foo content from site #2 (aka foo.example.com)” and force redirects. It also lets you do cool things like “Allow users to log in from foo.example.com instead of domain.foo” but really I didn’t need any of that. The meat of the code is in the sunrise.php file, which when I studied, I realized was just doing the redirects “Send Site #2 to domain.foo” and for me, by renaming the home and siteURLs, I was already doing that.

    So what had I missed?

    define( ‘COOKIE_DOMAIN’, $_SERVER[ ‘HTTP_HOST’ ] );

    That was it. I forgot to tell it “Cookies belong to the domain you’re on.” What this means is that if you log in at example.com, the cookie you get is for example.com and not domain.foo! For the most part, this isn’t a problem since no one logs in but me … until you try to make a purchase and it validates a cookie which doesn’t match the domain. I added that to my wp-config.php (down at the end of my Multisite section, where the SUNRISE define had been earlier) and everything magically worked.

    Two lessons! First, test everything. Second, you can map domains without a plugin, safely.

    Thread Starter alexlii

    (@alexlii)

    Mapping Domains Without a Plugin

    Thread Starter alexlii

    (@alexlii)

    I am really confused by several wordpress MU domain mapping tutorials, any comments for the above configuration would be great helpful… Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress Multisite Without a Domain Mapping Plugin’ is closed to new replies.