Reputation: 173
I have just completed the Basic Task List laravel tutorial. But when i click on "Add task" button the url i get is http://localhost/task instead of http://localhost/laravel5.1/public/task which it should be. I have searched a bit but i could find an answear you to make the url pointing correctly. By the way i had forgoten to add the Application URL in the config/app.php. I added it, and creared cache with the php artisan cache:clear
command but still nothing. My laravel version is 5.1 .
Upvotes: 1
Views: 1145
Reputation: 11310
Reason : You should configure your application first and generate url properly
How : Inside config/app.php
set the 'url' => 'http://youraddresshost'
Note :
Changing the public folder as root in your apache is not the better solution, it won't work if you are moving the project to live server and you have multiple projects in it.
So, You should Generate your url in Laravel way i.e., via helper so that you can pointed to the correct destination.
Read more about Generating URL with laravel here
Even you can do this to generate the url as suggested here
echo url('user/profile');
echo url('user/profile', [1]);
Also, if you do some jquery function to redirect the url on button click, you should generate url accordingly.
Hope, this helps you
Upvotes: 1