• Hello guys,

    I wanted to share this with you guys because i’ve been working hours on this to get it working. Maybe some of you guys know this already but I want to help some people out who wants to the same as me.

    If you want at least two domains on one server (one IP) but you want to show them as separate domains without subfolders in the URL, this is the way I did it. Maybe some of you know better alternatives but it works on my site. I’m not an expert so maybe you guys can improve how i did this.

    This is the situation, the website is in this URL
    https://domain.com/domain/public_html/

    To make a domain look like domain.com and not domain.com/domain/public_html I used this .htaccess at the root /

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?domain.com.nl$ [NC]
    RewriteCond %{REQUEST_URI} !^/domain/public_html/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /domain/public_html/$1
    RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
    RewriteRule ^(/)?$ domain/public_html/index.php [L]

    Put this one as .htaccess in the folder /domain/

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
    RewriteCond %{REQUEST_URI} !^/domain/public_html
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    And put this one as .htaccess in /domain/public_html

    RewriteEngine On
    RewriteBase /domain/public_html/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /domain/public_html/index.php [L]

    Now, your URL looks fine and all the images show up like they should, but my admin bar disappeared. You must have this in your header.php and footer.php of your theme to make it show up again

    <?php wp_head(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple WordPress domains on one server with its own domain names’ is closed to new replies.