Свободное общение | Как настроить кеш?
Тема закрыта by
Gaush
Причина: ...
Причина: ...
Надо настроить кеширование, что мне надо прописать в .htaccess?
И где надо это прописать.
Вот нашел такой текст, он пойдет?
Cache-Control: max-age=604800
И где надо это прописать.
Вот нашел такой текст, он пойдет?
Cache-Control: max-age=604800
https://ruhighload.com/Как+использовать+php+и+memcache%3f
Не для криворуких
________
посл. ред. 10.03.2019 в 09:28; всего 1 раз(а); by wape
Не для криворуких
________
посл. ред. 10.03.2019 в 09:28; всего 1 раз(а); by wape
wape , это что, нужно каждую страницу и каждый файл кешировать?
Gaush (10.03.2019 в 09:30)
wape , это что, нужно каждую страницу и каждый файл кешировать?
wape , это что, нужно каждую страницу и каждый файл кешировать?
Ты думал что все так просто ?
wape , ладно, без кеша тоже сайт красиво выгледет.
Вот
# Cache-Control
<ifModule mod_headers.c>
# 30 дней
<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# 30 дней
<filesMatch "\.(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# 2 дня
<filesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesMatch>
</ifModule>
Куда его прописать в .htaccess?
AddDefaultCharset utf-8
DirectoryIndex index.php
Options -Indexes
RewriteEngine On
RewriteRule ^img/(.*)/800x450/(.*).jpg$ img.php?id=$1&img=$2 [L,QSA]
RewriteRule ^katalog/([0-9]+)$ /kat.php?id=$1 [L,QSA]
RewriteRule ^katalog/([0-9]+)/$ /kat.php?id=$1 [L,QSA]
RewriteRule ^katalog/([0-9]+)/([0-9]+)$ /kat.php?id=$1&page=$2 [L,QSA]
RewriteRule ^katalog/([0-9]+)/([0-9]+)/$ /kat.php?id=$1&page=$2 [L,QSA]
RewriteRule ^top$ /top.php? [L,QSA]
RewriteRule ^top/$ /top.php? [L,QSA]
RewriteRule ^top/([0-9]+)$ /top.php?page=$1 [L,QSA]
RewriteRule ^top/([0-9]+)/$ /top.php?page=$1 [L,QSA]
RewriteRule ^view/([0-9]+)$ /view.php?id=$1 [L,QSA]
RewriteRule ^view/([0-9]+)/$ /view.php?id=$1 [L,QSA]
ErrorDocument 404 "Not Found <br /><a href=/>Go back to main page</a>"
ErrorDocument 403 "Sorry can't allow you access today, 403 Status Codes Apache <br /><a href=/>Go back to main page</a>"
ErrorDocument 400 "Bad Request <br /><a href=/>Go back to main page</a>"
ErrorDocument 500 "Internal Server Error <br /><a href=/>Go back to main page</a>"
# Cache-Control
<ifModule mod_headers.c>
# 30 дней
<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# 30 дней
<filesMatch "\.(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
# 2 дня
<filesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesMatch>
</ifModule>
Куда его прописать в .htaccess?
AddDefaultCharset utf-8
DirectoryIndex index.php
Options -Indexes
RewriteEngine On
RewriteRule ^img/(.*)/800x450/(.*).jpg$ img.php?id=$1&img=$2 [L,QSA]
RewriteRule ^katalog/([0-9]+)$ /kat.php?id=$1 [L,QSA]
RewriteRule ^katalog/([0-9]+)/$ /kat.php?id=$1 [L,QSA]
RewriteRule ^katalog/([0-9]+)/([0-9]+)$ /kat.php?id=$1&page=$2 [L,QSA]
RewriteRule ^katalog/([0-9]+)/([0-9]+)/$ /kat.php?id=$1&page=$2 [L,QSA]
RewriteRule ^top$ /top.php? [L,QSA]
RewriteRule ^top/$ /top.php? [L,QSA]
RewriteRule ^top/([0-9]+)$ /top.php?page=$1 [L,QSA]
RewriteRule ^top/([0-9]+)/$ /top.php?page=$1 [L,QSA]
RewriteRule ^view/([0-9]+)$ /view.php?id=$1 [L,QSA]
RewriteRule ^view/([0-9]+)/$ /view.php?id=$1 [L,QSA]
ErrorDocument 404 "Not Found <br /><a href=/>Go back to main page</a>"
ErrorDocument 403 "Sorry can't allow you access today, 403 Status Codes Apache <br /><a href=/>Go back to main page</a>"
ErrorDocument 400 "Bad Request <br /><a href=/>Go back to main page</a>"
ErrorDocument 500 "Internal Server Error <br /><a href=/>Go back to main page</a>"
Омг, в isp есть настройка при редактировании домена
[xrystalll] (10.03.2019 в 17:49)
Night_devil , одним isp администрирование не ограничивается, малыш
Night_devil , одним isp администрирование не ограничивается, малыш
Я имел ввиду , что лучше не засорять htaccess если есть isp.