Base URL for Your Laravel 4 Website

Share Tweet

To get base URL of your website to generate links to your content or assets do following:

Set $url in app/config/app.php to your base URL:

'url' => 'http://localhost/example',

Use it everywhere with URL::to(), for example:

echo URL::to('assets/css/general.css');
/* outputs http://localhost/example/assets/css/general.css */
Share Tweet


Please start a discussion down below or send me an email!