WordPress links on multiple domains

I have WordPress blog on server {IP}/blog.

Recently I’ve bought 2 domains and configured 2 virtual hosts in Apache for this blog. This works but all links on site are directing to old location {IP}/blog/link_href.

Read More

I’ve tried to change WP_HOME and WP_SITEURL to $_SERVER[‘SERVER_NAME’] but this leads to links like www.sth.com/www.sth.com/link with double.

Related posts

Leave a Reply

1 comment

  1. If these are links you wrote yourself then they need to either be relative or have http in the front. The browser adds the site URL to relative links automatically.

    //this becomes `www.site.com/www.site.com/home`
    Href="www.site.com/home"
    
    //these are proper format
    Href="http://www.site.com/home
    Href="/home"
    Href="home" (from current directory)
    

    This may not be it for you… But I have seen it happen a couple of times now for wordpress users.