Jump to content

$config->urls->root and $config->httpHost Empty


Recommended Posts

Posted

Hi,

I've tried printing the domain url but can't get ProcessWire to return anything. I can get it to work if I manually define the url in config.php but shouldn't this be detected automatically?

Posted

Any chance you are using these inside a function or module?

In that case you'd need: 

wire('config')->urls->root 

Do you have debug mode turned on? That should let you know that you have an undefined variable: $config

  • Like 2
  • Thanks 1
Posted

Well:

$config->urls->root will usually just give you "/"

$config->httpHost should give www.example.com

How are you defining the url in config.php ?

Is this an issue in your local testing environment, or on a live server?

Posted

The domain is listed in the $config->httpHosts array. Does the domain need to be speicified for it to be callable via $config->urls? I was under the impression that it was pulled automagically from $_SERVER environment variables.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...