JavaScript expires headers can't be set to 12 months

I'm trying to make my website load faster. I used the tool YSlow to analyze the website and check for some improvements. My first step is to cache static files. Therefore I want to set the expires headers for a javascript file, but it doesn't work. I included the javascript in HTML like this:

<script type="text/javascript" src="//a.ph3nx.com/b.js"></script>

Then I changed my Apache2 httpd.conf file like this:

ExpiresActive On
ExpiresDefault "access plus 1 minutes"
ExpiresByType text/javascript "access plus 12 months"

The problem is that the javascript file still has a expiring date of 1 minute. I hope you can help me, thank you!

Solution:

ExpiresByType application/javascript "access plus 12 months"

Answers


Try such code:

  ExpiresByType text/javascript "access plus 12 month"
  ExpiresByType application/x-javascript "access plus 12 month"
  ExpiresByType application/javascript "access plus 12 month"

Also u can cache your files using .htaccess:

  <FilesMatch "\.js$">
  Header set Cache-Control "max-age=172800, public, must-revalidate"
  </FilesMatch>

Need Your Help

ASP.NET MVC 2: Using duplicate input partial views without duplicate validation

asp.net asp.net-mvc asp.net-mvc-2 partial-views

In an application being rewritten, originally a certain form included a drop down where the user chose one of two major options for how the input would be used in calculations elsewhere.

Convert a obscure? date format in a sql query to a human readable one

mysql sql date time

I've got a date format in a bigint field in this format "20130314123743" - YYYYMMDDHHMMSS and i need to do a mysql query on it and get it back to the user in something like yyyy-mm-dd hh:mm:ss.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.