WordPress.org

Ready to get started?Download WordPress

Forums

Multisite, subfolder, multiple domains (1 post)

  1. glen.pike.hf
    Member
    Posted 1 year ago #

    Hi,

    I have setup a WP multisite install with subfolder installs in a subdirectory of my webserver.

    I have Multilingual Press installed to facilitate translation of content and 2 sites in parallel for 2 different languages.

    Site1: /path/site/ (English)
    Site2: /path/site/ja/ (Japanese)

    The site is running under https with an AliasMatch to serve the files requested under /path/site/ from /var/www/another-install-folder

    I wrote a quick & dirty plugin to redirect the user to the appropriate site based on their browser language choice which is working well.

    What I would like to be able to do is have multiple domains pointing at the same site - not a domain per site in this instance.
    domain1.com domain2.com domain3.com

    I know this is not the _proper_ way of doing things, but it is for non-public website so I don't care about SEO, etc.

    I have tried using the /etc/hosts file on my client machine to spoof various domains:

    192.168.1.2 domain1.com domain2.com domain3.com

    and set up ServerAlias in Apache with wildcard domains as follows:

    ServerName sub.domain.com
    ServerAlias *.sub.domain.com domain1.com domain2.com domain3.com

    If I try to visit my site on any of the alternate domains, I get problems with WordPress trying to redirect to the default domain, but on http, which is not served on my machine so I get a timeout.

    I have tried to change the DOMAIN_CURRENT_SITE to:

    define('DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST']);

    Which gives me a database connection error.

    I know internally the site_url / home_url are pretty much "hardcoded", but is there any way WP can deal with having multiple domains pointing at the same Multisite without redirecting to the "default" domain?

    Thanks

    Glen

Topic Closed

This topic has been closed to new replies.

About this Topic