Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@petermann
Last active August 12, 2020 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petermann/16650dcb6deb667d6f47dda8b1214594 to your computer and use it in GitHub Desktop.
Save petermann/16650dcb6deb667d6f47dda8b1214594 to your computer and use it in GitHub Desktop.
Multiple Domains into Single Instance of WordPress
# BEGIN NO-WWW Redirection
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
</IfModule>
# END NO-WWW Redirection
# BEGIN HTTPS Redirection
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END HTTPS Redirection
/*
* Handle multi domain into single instance of wordpress installation
*/
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment