derrickrozay
derrickrozay

Reputation: 1046

Laravel linking assets files to root of domain but not subfolder that the site is in

I have a site that is www.project.example.com/apps/myapp and I have various javascript and css files linked like this

<link rel="stylesheet" type="text/css" href="{{asset('/css/app.css')}}"/>
<link rel="stylesheet" type="text/css" href="{{asset('/css/myapp.css')}}"/>
<script type="text/javascript" src="{{asset('js/app.js')}}"></script>
<script type="text/javascript" src="{{asset('js/vendor.js')}}"></script>

But I keep getting a 404 not found error because its looking for the files in www.project.example.com/css for example.. Its not even looking in the assets folder

How can I fix this without having to change the path for every css and javascript file?

Upvotes: 0

Views: 871

Answers (1)

derrickrozay
derrickrozay

Reputation: 1046

fixed it. had to set base href in index.php and use relative links

<base href="/apps/myapp/"

<link rel="stylesheet" type="text/css" href="css/app.css'"/>
<link rel="stylesheet" type="text/css" href="css/myapp.css"/>

Upvotes: 1

Related Questions