• I have wordpress installed on site.com and have also bought site.net

    I would like site.net to behave in the same way as site.com (I have set it up as a domain alias).

    Unfortunately when you go on site.net, wordpress redirects you to site.com and also rewrites the urls on the page to use .com – is there any way around this (i.e. so its all branded as .net)?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    WordPress expects you to have it one way or the other. This is for a lot of reasons, the main one being SEO. Search engines don’t like duplicated content, and if they see the same thing at site.net that they see at site.com, you might get dinged for it.

    My advice would be to pick which one you want and stick with it. Whichever one you want, set that in the General Options screen, as the site’s URL.

    munky… or… you can try putting this code in the beginning of your index.php file, BEFORE any wordpress code.

    <?
    	// Check Domain and Change to Proper Spelling if Necessary
    	$our_server = "site.com";
    	$our_http = "https://www.site.com";
    	if ( isset($HTTP_HOST) && !eregi($our_server, $HTTP_HOST)) {
    		header("location: $our_http$REQUEST_URI");
    		exit;
    	}
    ?>

    What this will do is check the incoming domain (site.com or site.net) and switch it to your primary one BEFORE loading the wordpress calls.

    Please note, this must be used at the top of the index.php file, and there can not be any blank lines or spaces before any of it, or you’ll get a headers already sent php error.

    Also please note, the above is provided with no guarantees. Use at your own risk. But if it’s any help, it’s what I use for to handle all domains pointing to my site (.com, .net, .us, .org, etc plus all my registered misspellings of my domain as well) and it works just fine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Domain alias’ is closed to new replies.