Skip to content

Instantly share code, notes, and snippets.

@AndisGrossteins
Created January 21, 2021 14:56
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 AndisGrossteins/0cde643ec1ae7e309035a6143d4d306b to your computer and use it in GitHub Desktop.
Save AndisGrossteins/0cde643ec1ae7e309035a6143d4d306b to your computer and use it in GitHub Desktop.
Run WordPress site with any given domain name by setting two constants in wp-confing.php
<?php
// Snippet [...]
// Use any provided domain name from request as the site URL without redirection
// Note: Your Apache/Nginx or whatever server has to be configured to serve any chosen domain names from same document root directory
if( isset($_SERVER['HTTP_HOST']) ) {
define('WP_HOME', "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}");
define('WP_SITEURL', WP_HOME);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment