mardi 23 octobre 2018

Laravel Assets Point to Localhost/public instead of localhost/project/public

I recently used git to clone a Laravel 5.1 project from a repository to my local environment. I am using XAMPP, so I placed the project under C:/xampp/htdocs and can access it from localhost/project/public.

I updated the APP_URL variable in the.env file to point to "http://localhost/project".

I also updated the url value in config/app.php to:

'url' => env('APP_URL', 'http://localhost/project')

Right now, the both scripts resolve as http://localhost/public/assets/js/test.js:

I removed "/public" (also "public", just tetsing things) and replaced with so that now the call looks like the following and the script resolved just fine:

<script src="/assets/js/test.js"></script>

However, elixir is also being used:

<script src="."></script>

The page is not loading correctly; an Ajax call that errors out because the URL is is trying to reach is localhost/public/someotherfolder/details?=12345).

The above script seems to be the source of that AJAX call; if I comment it out, then the call doesn't run.

I checked the rev-manifest.json and it specifies "js/app.js". If I try to changed the script call to I get a 404 error. If I try add the path in the elixir call, I get a "file is not defined in manifest". Changing the manifest to use the whole path seems to defeat the purpose.

How can I solve this issue? It seems like I am missing an important step to let my application resolve without using the full path?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire