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?

  • 1
    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. Commented Feb 18, 2014 at 19:15

2 Answers 2


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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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