The problem is that I change the js files that are in the public folder. But after I upload them to the server using git, nothing changes on the server and the site appears as if it is the old js. Although even if I go through the server and see the content of the file, it is updated.
I tried clearing laravel caches.
php artisan view:clear
php artisan route:cache
php artisan cache:cl
php artisan optimize:clear
I’ve tried clearing the server’s own cache. Also I updated my browser cache and it still doesn’t work.
It only helps if I rename the file to a name I have not named yet. Then it will be updated on the site.
2
Answers
After double-checking everything related to your file, including Git, file paths, and other aspects, you can try renaming the file. If renaming the file leads to the updated version being displayed on the site, it suggests that the issue might be related to caching mechanisms. In such cases, you can consider implementing cache-busting techniques like appending a query parameter with a unique value to the file URL (e.g., script.js?v=1234). This ensures that the browser always fetches the updated file.
Please note that it’s always a good idea to thoroughly investigate and address the root cause of the caching issue to prevent it from reoccurring in the future.
Are you sure your public folder isn’t included in the .gitignore file?
You can also check if your remote repository is getting updated or not.
By the way, using
php artisan optimize:clear
is enough, you don’t need to run all those.