简体   繁体   中英

Laravel sub-folder installation creates issue with redirection

I have installed Laravel app in subfolder. The URL is like: mysite.com/laravel/public/index.php/home

It is working fine, but when I click on the menu items like /name , it is redirecting me back to home mysite.com but I want it to be like mysite.com/laravel/public/index.php/name

Laravel's own default routes, like {{ route('register') }} is working fine from anywhere I test but my own defined routes are not working.

How can I fix it? I have searched it but got nothing. Please help.

Thank you.

Even if you installed Laravel in subfolder, you path for /home should be:

mysite.com/laravel/public/home

When you are defining routes, your /name still should be defined as:

Route::get('/name', 'Controller@function');

Linking from Blade when Laravel is installed in subfolder might get a bit tricky:

{{ URL::to('/') }}/name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM