Redirect undesirable domain

Edit functions.php

To be certain your WordPress site is pointing to the correct URL do this.

  1. Got to your themes functions.php file found at /wp-content/themes/ theme-name
  2. Add these two lines to the file, immediately after the initial <?php line.

update_option( ‘siteurl’, ‘http://example.com‘ );

update_option( ‘home’, ‘http://example.com‘ );

  1. Make sure you clear all cache and if using CloudFlare, put it into development mode.
  2. Check you have no redirects in your .htaccess files

  3. Now check to see if your site points to the correct URL.

If it doesn’t it’s likely you have a DNS setting that needs changing. Check your parked domains to make sure one isn’t set as a redirect there as seen in the WHM setting I have on my server in the below image.

enter image description here

*Once you have solved the issue, it’s a good idea to remove your added code from functions.php. If you don’t you won’t be able to change these settings in the WordPress setting until you do so.

tech