Jump to:

23581 Posts in 19403 Topics by 2893 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] Server Check if localhost

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 563 Views
  • Graphicator
    Avatar
    Community Member
    62 Posts

    [SOLVED] Server Check if localhost Link to this post

    I'm syncing across local computers over to my remote server. In light of Director::set_dev_servers, I would like to know if I can check if the status of where I am viewing the site.

    If it is localhost, i'd like to run

    require_once('conf/ConfigureFromEnv.php');

    If it is on the server

    $databaseConfig = array(...

  • Graphicator
    Avatar
    Community Member
    62 Posts

    Re: [SOLVED] Server Check if localhost Link to this post

    define('current_domain', $_SERVER['HTTP_HOST']);

    start of conditional statement
    #### whatever port you are running your test server

    if(current_domain == "localhost:####"):

    then include the localhost environment...

    this allows me to safely sync and overwrite the complete mysite folder

    563 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.