Support the ongoing development of Laravel.io →
posted 9 years ago
Views
Last updated 2 years ago.
0

Make your master layout to set the <base> tag pointing to your base URL so all the relative links of your assets are always referred to your base URL instead of your current URL.

more info

Last updated 2 years ago.
0

Thanks, but I don't think set the base tag is a good solution for this kind of problem.

for example, on my development environment, the application are accessed with http://localhost/, which is root directory, but on the real production environment, this might be change to any folder, like client directory on site A, also might be members directory on site B.

so setting the base tag will need to modify each site's master layout file.

Is there any other way to do this?

Last updated 2 years ago.
0

how stupid I am. just add this to head section of layout

<base href="{{URL::to('/')}}/">

then every relative link will work now.

Notice: you must add the tailing slash.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

steve3d steve3d Joined 21 May 2014

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.

© 2024 Laravel.io - All rights reserved.