4

I am developing a website with php jquery Sass bootstrap etc etc

The way I have it set up, I have one index page that has all of the includes for the header, css files and js files, and different pages are loaded with a SESSION variable that tells the index what page to include (and there is also a helper page that reads GET variables and stores them in the session and redirects back to the index).

I noticed that if I add a new include or change an include on the index page I have to close the tab and open it again in a new one in order for that to take effect. It's not a huge deal, but its wasting a lot of my time trying to find errors that don't exist.

Anyone have any ideas of what would be causing this?\

EDIT: I realized that this problem occurs with every change I make to the css files (but not the php files) and logging out of my site and logging back in will show the changes, so I don't actually have to close the page. It seems like an issue with the SESSION. I also thought it might have to do with the header(location:) command since your not supposed to use it with in the body of html, so i switched it to echo '<script type="text/javascript">window.location.replace();</script>'; and that didn't fix it either. Also added:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");

to my header.php file and that didn't solve it either.

erikstagg
  • 79
  • 7
  • what type of pages are you wanting to reload? php, html, css, javascript? – Sean Nov 25 '15 at 03:42
  • All the pages are php pages, but the includes (css or javascript) is what I want to load without having to exit the page – erikstagg Nov 25 '15 at 04:07
  • possible solution for css/javascript files http://stackoverflow.com/a/12992803/689579 from [How to prevent CSS caching on a web page?](http://stackoverflow.com/questions/12992717/how-to-prevent-css-caching-on-a-web-page) – Sean Nov 25 '15 at 04:17
  • That might help, but the last time i notice this happen was because I added a Javascript include that wasn't even being detected, and i literally refreshed that page and firefox wasn't seeing it (via developer tools) closed out of the page and brought it back up and then firefox saw it – erikstagg Nov 25 '15 at 04:21
  • then try using that method on your html -> `index.html?version=1234` and php -> `index.php?version=1234`. for example `index.php?version=` – Sean Nov 25 '15 at 04:24
  • Its actually doing it right now and I tried appending that to my link and it didn't do anything. It might have something to do with my web server, or the ftp or something – erikstagg Nov 25 '15 at 04:51
  • Possible duplicate of [Force page to reload from server instead of load the cached version](http://stackoverflow.com/questions/10132446/force-page-to-reload-from-server-instead-of-load-the-cached-version) – The Beast Dec 02 '15 at 02:24

1 Answers1

1

It appears that apache2 was caching these files. I added some lines to my apache2.conf file telling it not to cache this specific site and so far so good. I will update again if it turns out this wasn't a fix and it only started working temporarily.

erikstagg
  • 79
  • 7