Andrew T Andrew T - 5 days ago 6
PHP Question

laravel route fix needed

I have a laravel project which I run from my local apache server directory.
The link for accessing this project is

www.localhost/project.dev/public/index.php


And I have a navigation menu

navigation menu

After I have set the APP_URL in .env file to

http://localhost/blog.dev/public/index.php/


I get no problems while navigating through the About and Contact pages in the project but when I access the Home page the browser goes to the

http://localhost/


but not to the

http://localhost/blog.dev/public/index.php/


How can I fix it? Here are my routes:

Route::get('/', 'PagesController@getIndex');
Route::get('about', 'PagesController@getAbout');
Route::get('contact', 'PagesController@getContact');

Answer

I think the best way is to setup a vhost in apache. if you want to work like this in your .env set the APP_URL= http://localhost/blog.dev/public/

Comments