Home
/
WordPress
/
Configuration
/
Domain Masking with WordPress

Domain Masking with WordPress

Domain masking allows you to display content from one domain while keeping another domain in the browser’s address bar. While we often suggest parking the domain name, with WordPress, this usually results in redirects. This is because the WordPress database specifies which domain to use in the wp_options table, particularly in the site_url and home_url fields.

It’s important to note that while domain masking is technically possible, it may not work with all WordPress setups. If redirects still occur after following these steps, you can post a new Expert Care request and we will attempt to implement the domain masking for you.

How to Implement Domain Masking

Step 1: Locate and edit the wp-config.php File

Open your Site Tools and go to Site -> File Manager. Navigate to the public_html folder of your website, select the wp-config.php file and click the Edit button.

Open the live site's wp-config.php to find the database name

Step 2: Add the Following Lines

Add the following lines before the line that reads /* That’s all, stop editing! Happy publishing. */:

define('WP_SITEURL', 'https://'.$_SERVER['HTTP_HOST']);
define('WP_HOME', 'https://'.$_SERVER['HTTP_HOST']);

The provided code dynamically sets the site_url and home_url based on the domain from which the request is made. This ensures that the site_url and home_url always match the accessed domain.

Step 3: Save Changes

Save the changes to your wp-config.php file to apply them and then verify the functionality of your website by accessing it with both domain names.

Share This Article