Created
January 21, 2021 14:56
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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