WordPress.org

Ready to get started?Download WordPress

Forums

virtual hosts and siteurl (2 posts)

  1. stringfellow
    Member
    Posted 9 years ago #

    Hi,
    I've had a problem with wordpress in that I use blog.spam.eggs:8080 as the base url, but when inside my home network I use blog.parrot, as a setup issue causes a connection refused when trying to contact blog.spam.eggs:8080 (this is my fault, but it doesnt affect the problem other than allowing me to discover it!)
    So, basically when im on my network, its trying blog.spam.eggs:8080 when it wants blog.parrot, and this was due to the siteurl variable being strictly defined.. Perhaps I missed something somewhere but anyhow;
    I managed to get around this by editing get_settings so that when given 'siteurl' it would return 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].'/'
    But it would be nice to see this as an option to set the base url as that variable, as opposed to something static.
    Just a thought ;)

  2. TJworld
    Member
    Posted 8 years ago #

    I've just experienced the exact same issue, and was about to make the same change.

    Its a real problem when you've got multiple domain names pointing to the same site.

    My alteration also deals with SSL connections, and only uses the port when its not port 80.

    $siteurl = ($_SERVER["HTTPS"]=='on' ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].($_SERVER["SERVER_PORT"] != 80 ? ':'.$_SERVER["SERVER_PORT"] : '');

Topic Closed

This topic has been closed to new replies.

About this Topic