using mod-rewrite to redirect requests for jquery.js to GoogleAPI cache
- by Aditya Advani
Hi All,
Our Linux server with Apache 2.x, Plesk 8.x hosts a number of e-commerce websites. To take advantage of browser caching we would like to use Google's provided copy of jquery.js.
Hence in the vhost.conf file of each we can use the following RewriteRule
RewriteCond %{REQUEST_FILENAME} jquery.min.js [nc]
RewriteRule . http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js [L]
And in vhost_ssl.conf
RewriteCond %{REQUEST_FILENAME} jquery.min.js [nc]
RewriteRule . https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js [L]
OK now these rules work fine in the individual vhost.conf files of each domain. However we host over 200 domains, I would like for them to work but cannot seem to get them to work globally in the httpd.conf file.
Challenges are the following:
Get the rewriterule to work in httpd.conf
Detect if HTTPS is on, and if it is and the is is a secure page, rewrite to ...
Each individual domain will still have it's own custom mod-rewrite rules. Which rules take precedence - global or per-domain? Do they combine? Is it ok if I have the "RewriteEngine On" directive in the global httpd.conf and then again in the vhost.conf?
Please let me know what your guys' suggestions are. Desperate for a solution to this problem.