Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code in my .htaccess file that caches several file extension types:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"

I would like to add a remote file to the list www.example.com/js/jqueryvalid.js... Is this possible?

share|improve this question
You shouldn't care too much about 'remote' cache times, I assume your trying to score high on a speed test. Often CDN's will use much lower cache times but even with a low time they generally are faster than internal hosting with high cache times. – Simon Hayter Feb 18 '14 at 19:15
up vote 1 down vote accepted

You can't control files on another domain with .htaccess or any other means without making changes on the other server. So, no, this is not possible.

share|improve this answer

Add a local js file which loads the remote js file script.


Now add this local file to .htacces and set expiry. Not sure if it works. Check.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.