M
M
MdaUZH2016-02-05 12:24:11
PHP
MdaUZH, 2016-02-05 12:24:11

How to properly use the browser cache?

Hello everyone ...
How to work with the browser cache?
There are various options, somewhere I saw a time limit for each loaded element, and somewhere in htaccess, well, how would it be more correct to implement all this?
For example, for js / html / css files, set the cache for a month
and for images for several hours
And some images do not need a cache at all
I would be very grateful for advice

Answer the question

In order to leave comments, you need to log in

5 answer(s)
K
Kravalg, 2016-02-06
@MdaUZH

The browser will cache or not cache the files you specify in the headers. You specify them using php or htaccess - it doesn't matter. It is important to set them in the most convenient way for you based on the task at hand.
Need to dynamically change caching times and file types?
Use sending headers from php using the headers(); function.
Do you need static rules that will change infrequently?
Use the rules for htaccess:
habrahabr.ru/sandbox/55709
This is how we can check the headers
highloadtools.com/cachecontrol

W
WebSpider, 2014-09-27
@jkwe45

Maybe you forgot the quotes?
$pr_fname = filter_input(INPUT_POST, 'pr_fname');

S
svd71, 2014-09-27
@svd71

What does
Var_dump($_POST) show in added.php ?

H
Heafy, 2014-09-27
@Heafy

post'om and so super global variables walk.
they do not need to be passed as an argument.

Z
Zeeeee, 2014-09-27
@Zeeeeee

Quotes are required, otherwise it will be "Use of undefined constant".
Cyrillic is not present anywhere in pr_fname?
Turn on the display of errors, maybe you have something else somewhere.
error_reporting(E_ALL);
ini_set("display_errors", 1);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question