1

I am working on Laravel(5.4) project. I am facing an strange issue regarding the laravel views. My all views are working fine but some views are always showing the old content and I've to refresh the page manually to get the latest data.I am using midphase server with https://. Other strange thing is that same code is working fine on my testing server, which is on GoDaddy and I am NOT using https for it, there is no cache issue on it and also there is no cache issue on my localhost. Kindly guide me, how to solve this cache issue.

  • Have you tried clearing the view cache like it's [mentioned here](https://stackoverflow.com/questions/29152102/laravel-5-clear-views-cache)? – Máté Feb 22 '18 at 11:53
  • 1
    `php artisan cache:clear` / `php artisan view:clear` – Option Feb 22 '18 at 11:54
  • yes I tried these commands but still facing the same issue – abdul wahab Feb 22 '18 at 12:01
  • Are you sure this isn't your browser causing the problem with offline cache / cookies? – Option Feb 22 '18 at 12:02
  • can you please expain it little bit more "browser causing the problem with offline cache / cookies" because apparently its the browser cache issue but its not happening for all views and one more thing when I added no-cache code in my .htaccess file then site is working fine but then my site is becoming very slow bcz of not saving data in cache – abdul wahab Feb 22 '18 at 12:11
  • @abdulwahab can you post your `.htaccess` file from public – FULL STACK DEV Feb 22 '18 at 12:14
  • here is my .htaccess code `code` RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteRule ^(.*)$ public/$1 [L] Header set Pragma "no-cache" Header set Expires 0 `code` when I add this code then my site is working fine without any cache issue, but its make my site very slow so I don't prefer this solution – abdul wahab Feb 22 '18 at 12:22
  • @abdulwahab its not a issue with laravel. its a caching issue by your webserver. – FULL STACK DEV Feb 22 '18 at 12:31
  • yes, kindly can you please tell me is there any setting on webserver for cache ? or can I fix this issue or should I call to midphase server developers? BTW I already contacted them and they said they've nothing to do with the cache issues. now I am fed up what should I do ? – abdul wahab Feb 22 '18 at 12:38

1 Answers1

0

Just try clear the view cache using the following command

php artisan help view:clear

Hope the above command will help you Thanks.

Anil Kumar Sahu
  • 567
  • 2
  • 7
  • 27
  • yes I tried this command but its not refresh the whole page so it is showing the same old content but when I refresh the page from browser's refresh button then view shows the latest data – abdul wahab Feb 22 '18 at 11:59