Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lahore, Pakistan
    Posts
    150
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How to make the date dynamic in header expiry attribute of htaccess

    Hi,

    I am using the following code in my htaccess to "Expire Headers"


    <FilesMatch "\.(ico|jgz|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Expires "Thu, 21 July 2011 20:00:00 GMT"
    </FilesMatch>


    Currently, i have set the date as static. Is there anyway in htaccess to make this date dynamic.

    Thanks

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,855
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Is there anyway in htaccess to make this date dynamic.
    You could make a php script to edit the htaccess file and set it as a cron job.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Jun 2011
    Location
    England; Essex
    Posts
    42
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Code:
    <FilesMatch "\.(ico|jgz|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
      ExpiresDefault A120
      Header append Cache-Control "public, proxy-revalidate"
    </FilesMatch>
    A120 = 2 minutes (so replace 120 with your expire length
    Above is the htaccess i use (just changed to your file extensions)

  • #4
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lahore, Pakistan
    Posts
    150
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The above code give errors


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •