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.

7
  • what type of pages are you wanting to reload? php, html, css, javascript? Commented Nov 25, 2015 at 3: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 Commented Nov 25, 2015 at 4:07
  • possible solution for css/javascript files stackoverflow.com/a/12992803/689579 from How to prevent CSS caching on a web page? Commented Nov 25, 2015 at 4: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 Commented Nov 25, 2015 at 4:21
  • then try using that method on your html -> index.html?version=1234 and php -> index.php?version=1234. for example index.php?version=<?php echo time();?> Commented Nov 25, 2015 at 4:24

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

How did you edit the file to prevent caching?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.