• I have multiple domains for several languages and a few “generic” domains.
    My intention was that the identity of the domains remains and stay visible.

    For example website.nl goes to the NL language, EU to the EN language, and so on.

    Below I configured the .htaccess, and the direction works, but… the domain switch to the “primary” domain. But I want to keep the identity of the aliases also visible in the browser.

    How can I make that happen?

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # Main Redirect
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^website\.nl$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.website\.nl$
    RewriteRule ^/?$ "https\:\/\/website\.nl\/nl\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^website\.eu$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.website\.eu$
    RewriteRule ^index\.html$ "https\:\/\/website\.eu\/en\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^website\.online$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.website\.online$
    RewriteRule ^indexingles\.html$ "https\:\/\/website\.online\/en\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^website\.fr$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.website\.fr$
    RewriteRule ^indexingles\.html$ "https\:\/\/website\.online\/fr\/" [R=301,L]
    • This topic was modified 2 years, 7 months ago by mvlaspld.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I think the RELOCATE method described here will work for you, with significant modification. Note that the proffered code is insecure, as noted. For improved security, make an array of acceptable domain names and verify the $_SERVER values are in the array before doing anything.

    And instead of updating the option and setting the URL scheme, define WP_HOME and WP_SITEURL as described if you scroll up from the linked location.

    If you make this all secure with a whitelist, you needn’t really do the RELOCATE portion since there shouldn’t be a need to turn this on and off.

    Sorry for the convoluted instructions, I hope you can make sense of it. The gist is to set the home and site URL constants to the values passed in $_SERVER.

Viewing 1 replies (of 1 total)
  • The topic ‘Multiple Domains with alias to same hosting’ is closed to new replies.