0

Getting the above error when trying to add a new entry to a structure section.

The Section has an Entry URL Format of:

{siteUrl}/{slug}

In my general.php in the config folder I have:

return array(

    '*' => array(
            'omitScriptNameInUrls' => true,
        ),


    'local.ontherocks.dev' => array(
        'devMode' => true,
        'environmentVariables' => array(
            'basePath' => 'C:/Users/User/Documents/My Websites/Sitename/public/',
            'baseUrl'  => 'http://local.ontherocks.dev/',
            'siteUrl'  => 'http://local.ontherocks.dev/',
        )   
    )

);

I don't see why I am getting this error - I have the same set up in another site I did.

1

Environment variables are only available in specific settings, and Entry URL Formats are not one of them.

There’s no need to include your Site URL in there anyway, though. The field’s label might be a little misleading – it’s really more of a URI format than a URL format.

If you want your entries to get URLs like http://example.com/entry-slug, then all you need to put in your section’s Entry URL Format setting is:

{slug}
2
  • Thanks - changing that has removed the error. I have it set like that in a previous site and it worked but must be something else to it.
    – mmc501
    Oct 24 '14 at 12:54
  • @mmc501 Glad you’re all sorted. The only way it would work is if you had a custom field with the handle “siteUrl”. Oct 24 '14 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.