Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

## EXPIRES CACHING ##
<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"
</IfModule>
## EXPIRES CACHING ##

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

share|improve this question
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. –  bybe Feb 18 at 19:15

2 Answers 2

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.

$.getScript("url")

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

share|improve this answer

Your Answer

 
discard

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.