{"id":6012,"date":"2010-03-22T18:43:15","date_gmt":"2010-03-23T01:43:15","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=6012"},"modified":"2010-03-22T18:43:15","modified_gmt":"2010-03-23T01:43:15","slug":"set-expires","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/htaccess\/set-expires\/","title":{"rendered":"Set Expires"},"content":{"rendered":"

Setting “expires” tells browsers downloading these files that they don’t need to request it again for this specific length of time. In otherwords, use the cache instead if you have it. This can reduce stress on the server for you, and speed up page load time for visitors.<\/p>\n

# BEGIN EXPIRES\r\n<IfModule mod_expires.c>\r\n    ExpiresActive On\r\n    ExpiresDefault \"access plus 10 days\"\r\n    ExpiresByType text\/css \"access plus 1 week\"\r\n    ExpiresByType text\/plain \"access plus 1 month\"\r\n    ExpiresByType image\/gif \"access plus 1 month\"\r\n    ExpiresByType image\/png \"access plus 1 month\"\r\n    ExpiresByType image\/jpeg \"access plus 1 month\"\r\n    ExpiresByType application\/x-javascript \"access plus 1 month\"\r\n    ExpiresByType application\/javascript \"access plus 1 week\"\r\n    ExpiresByType application\/x-icon \"access plus 1 year\"\r\n<\/IfModule>\r\n# END EXPIRES<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

Setting “expires” tells browsers downloading these files that they don’t need to request it again for this specific length of time. In otherwords, use the cache instead if you have it. This can reduce stress on the server for you, and speed up page load time for visitors. # BEGIN EXPIRES <IfModule mod_expires.c> ExpiresActive On […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3826,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[{"id":155747,"url":"https:\/\/css-tricks.com\/lodge\/learn-jquery\/29-getting-production-ready\/","url_meta":{"origin":6012,"position":0},"title":"#29: Getting Production Ready","date":"November 12, 2013","format":false,"excerpt":"We're going to bring it back out to a normal text editor in this screencast, just as we started. In a \"real world\" situation, these things are true: You want to break up your JavaScript into as many small files as makes sense to you. Just like we broke up\u2026","rel":"","context":"With 6 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":334164,"url":"https:\/\/css-tricks.com\/video-screencasts\/203-a-first-look-at-cloudflare-pages\/","url_meta":{"origin":6012,"position":1},"title":"#203: A First Look at Cloudflare Pages","date":"March 2, 2021","format":false,"excerpt":"Cloudflare Pages is Jamstack hosting, meaning it's a static file host that runs your builds and lets you do dynamic things with JavaScript and services. You might normally think of Cloudflare as something you put in front of your site's hosting, but this is your site's hosting. Extreme speed is\u2026","rel":"","context":"In \"cloudflare\"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/02\/site-thumb.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":154528,"url":"https:\/\/css-tricks.com\/lodge\/learn-jquery\/20-data-data-data-attrdata\/","url_meta":{"origin":6012,"position":2},"title":"#20: Data! data-*! .data()! .attr(data-*)!","date":"October 29, 2013","format":false,"excerpt":"Data. In the world of jQuery, it's all about bits of information that are attached directly to elements (rather than, say, a variable with onus only to itself). There is a ton of ways to save bits of data on the \"client side\" (in the browser, rather than the server).\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":19305,"url":"https:\/\/css-tricks.com\/snippets\/javascript\/cookie-gettersetter\/","url_meta":{"origin":6012,"position":3},"title":"Cookie Getter\/Setter","date":"November 27, 2012","format":false,"excerpt":"\/** * Gets or sets cookies * @param name * @param value (null to delete or undefined to get) * @param options (domain, expire (in days)) * @return value or true *\/ _.cookie = function(name, value, options) { if (typeof value === \"undefined\") { var n, v, cookies = document.cookie.split(\";\");\u2026","rel":"","context":"With 4 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":149891,"url":"https:\/\/css-tricks.com\/lodge\/learn-jquery\/10-explicit-vs-implicit-iteration\/","url_meta":{"origin":6012,"position":4},"title":"#10: Explicit vs Implicit Iteration","date":"September 13, 2013","format":false,"excerpt":"Another concept video! This is \"just one of those thing\" you need to understand in jQuery. It is actually a bit unique to jQuery, in that other popular JavaScript libraries in the past have not done it this way. We've already covered selectors quite a bit. For instance, you already\u2026","rel":"","context":"With 5 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":195626,"url":"https:\/\/css-tricks.com\/snippets\/htaccess\/denying-allowing-access\/","url_meta":{"origin":6012,"position":5},"title":"Denying and Allowing Access","date":"February 11, 2015","format":false,"excerpt":"Deny except from specific IPs Order deny,allow Deny from All Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxy Allow except from specific IPs Order deny,allow Allow from All Deny from xxx.xxx.xxx.xxx Deny from xxx.xxx.xxx.xxy","rel":"","context":"With 1 comment","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/6012"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=6012"}],"version-history":[{"count":1,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/6012\/revisions"}],"predecessor-version":[{"id":6013,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/6012\/revisions\/6013"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3826"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=6012"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=6012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}