• Can anyone clarify what the default behaviour is for WordPress when more than one domain points to a WordPress site. Should WordPress always redirect to the wp_home and wp_siteurl addresses (which are the same in this case)? Or will WordPress serve the site on whatever domain has been called?

    We have some sites where the root domain doesn’t redirect to the www. until we disable a specific plugin, then the redirection does happen.

    (I’m aware we can do this in .htaccess, I want to know what the default behaviour of WordPress is for troubleshooting)

Viewing 3 replies - 1 through 3 (of 3 total)
  • That’s not the job of WordPress.

    It’s a web server configuration issue.

    Each virtual host on the domain should have its own directory (aka DocumentRoot) to point to.

    If you just point the domain to the server without configuring any document root for it, then the domain will simply forward to whichever virtualhost/website has been configured as the default vhost.

    Thread Starter webmuppet

    (@webmuppet)

    I understand that, but I’m trying to find out what the WordPress default behaviour is.

    If sub1.domain.com and sub2.domain.com both point to the same virtual host and the same WordPress install, will WordPress serve the site on both domains or will it redirect to the wp_siteurl address.

    If sub1.domain.com and sub2.domain.com both point to the same virtual host and the same WordPress install, will WordPress serve the site on both domains or will it redirect to the wp_siteurl address.

    It’s the latter case, but it’s not really WordPress doing any redirection.

    The web server is serving the same content for sub1.domain.com as for example.com, because they have a common document root.

    But since the WordPress site was set up with example.com, all permalinks and media URLs generated by WordPress have example.com pre-fixed as absolute URLs in the database.

    So WordPress is not really actively doing any re-direction per se. Just that the landing page for sub1.domain.com, which is the WordPress site setup with example.com, has all links on the page fixed to example.com URLs (and not sub1.domain.com).

    This is just like forwarding your domain to Google.com. Your domain will take you to Google.com. But once you land there, all links will point to and show Google.com, and not whatever domain brought you there.

    There are 3rd-party plugins that can change the permalinks on the fly and allow the entire site (or specific portions, eg a category or even a single post/page) to work with multiple domains.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Default WordPress behaviour with multiple domains’ is closed to new replies.