1

When calling my links, they're appearing and trying to link like so:

testurl.com/university/testurl.com/university/arizona-state/

Really it should just be

testurl.com/university/arizona-state/

The line that is generating a category URL:

        <a class="university-widget w-inline-block" href="{{ category.url }}">

and my general.php:

return array(

  '*' => array(
  ),

  'localhost' => array(
    'devMode' => true,
    'siteUrl' => 'http://localhost:8888/',
    'server' => 'localhost',
        'enableCsrfProtection' => true,
        'defaultWeekStartDay' => 0,
        'omitScriptNameInUrls' => 'auto',
        'defaultSearchTermOptions' => array(
            'subLeft' => true,
            'subRight' => true,
        ),
        'cpTrigger' => 'admin',

    'environmentVariables' => array(
      'baseUrl'  => 'http://localhost:8888/',
    ),
    'testToEmailAddress' => 'dev@email.com',
  ),

  'testurl.com' => array(
    'siteUrl' => 'testurl.com',
    'server' => 'localhost',

        'enableCsrfProtection' => true,
        'defaultWeekStartDay' => 0,
        'omitScriptNameInUrls' => 'auto',
        'defaultSearchTermOptions' => array(
            'subLeft' => true,
            'subRight' => true,
        ),
        'cpTrigger' => 'admin',

    'environmentVariables' => array(
      'basePath' => '/var/www/html/',
      'baseUrl' => 'http://testurl.com/',
    )
  )
);
2

I generally find this snippet to be useful

(isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME']

Especially if you set up a virtual host locally in most situations you can define this in your * and it will work across local/staging/production.

Here's a basic example config:

'*' => [
    'environmentVariables' => [
        'basePath' => '/Users/your/path/to/site/',
        'baseUrl' => (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME']
    ],
    'enableCsrfProtection' => true,
    'devMode' => true,      
],

'live' => [
     'environmentVariables' => [
        'basePath' => '/srv/different/path/to/site/',
     ],
]
| improve this answer | |
  • Would you be able to edit this answer and include a snippet of the config file including this line to help others. – JMKelley Apr 17 '17 at 22:10
3

Fixed by changing the following line:

'siteUrl' => 'http://testurl.com',
| improve this answer | |

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.