Support the ongoing development of Laravel.io →
Installation Configuration Authentication

Hello Everybody I want to say I am very impressed with laravel blade and eloquent and I come from a codeigniter background.I am taking baby steps with laravel

So I installed laravel 5.1 and laravel provide login and register out of the box but when I go to auth/login page looks distorted with no css when I look in view source it shows css path /css/app.css I suppose it is not taking base Url I understand there is no concept of base url in laravel and everything is handled through routes.php.

Not only css when I hit login or register in the upper right corner login and register it takes me to 404 page not found. my url is http://localhost/larapack/public/ but when i hit login it takes me to http://localhost/auth/login page not found if I enter static url like http://localhost/larapack/public/auth/login it works.

In my htaccess I have RewriteBase /larapack/public/ and In my config/app.php I have 'url' => 'http://localhost/larapack/public' but nothing seems to work I have not touched any code so far this is out of box.

regards.

Last updated 3 years ago.
0

If your public directory is not the document root of your server, this will happen. There are a few choices.

  1. Run php artisan serve with your command line interface. From there, you can access your development site most likely on http://localhost:8000, and everything will render correctly.

  2. Or, you can load all your assets (css, images, scripts, etc.) using the asset helper method. So instead of /css/app.css, you can do asset('css/app.css') and it will render out the full path. In other words, it will render out 'http://localhost/larapack/public/css/app.css'.

For your routes, instead of using the asset() helper, you can use other helper methods like route(). This accepts your route name. So, lets say you have something like this in your routes.php file...

Route::get('auth/login', ['as' => 'login', 'uses' => 'Auth\AuthController@getLogin']);

'login' would be the path name so route('login') would render out the full path to your login url, which would be http://localhost/larapack/public/auth/login

Last updated 9 years ago.
0

Thank you for answer thomastkim asset helper worked like charm it was not working earlier I forgot to include curly braces I was not familiar with those helper.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

adammalle adammalle Joined 28 Sep 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.