Multiple domains on WordPress

Recently, I registered the .bit TLD for my site using Namecoin. That setup is described here.

However, one of the problems I described was using a CMS system like WordPress. Currently, it’s easy to serve a single HTML page over a .bit TLD. However, the trouble comes when using a CMS, like WordPress, that is hard-coded with a specific TLD (shown below).


Even though I could serve my front page via the .bit TLD, the rest of the links pointed to the .com TLD.

A commenter on Reddit pointed out that that there was a way to change WordPress to use multiple domains (e.g., and loganmarchione.bit). I did some Google-ing and came up with these two options in the wp-config.php file.

For this process, I’m assuming you have DNS setup for multiple records. In my case, I’m using Namecoin for DNS, so that part if taken care of.

After that, simply add the following lines to your wp-config.php file, after the table_prefix line.

* Multi-TLD support
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);

If you’re using HTTPS, be sure to add the “s” to your code.

* Multi-TLD support
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);

Reload your webserver and PHP processes and you should be able to visit your site in both TLDs, and depending on which TLD you visit, your links will be updated accordingly.

Note – It appears that any embeded files (e.g., images, videos, etc…) still use the .com TLD, since they hard-coded into each page.


Let me know if this helped you!


Leave a Comment