Reputation: 2688
So, since I host my blog on the same server as my site, I figured I would create an Alias so I could pull in my portfolio.
Alias /port-images/ /the/real/location/wp-content/uploads/
In both my blog and the site I am pulling the images into contain the following .htaccess code:
# caching static files
<IfModule mod_headers.c>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|bmp|js|css|swf|woff|svg|ttf|otf|eot)(\.gz)?$">
Header unset Pragma
Header unset ETag
Header set Cache-Control "max-age=31556000, store, cache"
Header unset Last-Modified
Header set Connection keep-alive
Header add X-PoweredBy ""
</FilesMatch>
</IfModule>
FileETag None
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html M31556000
ExpiresByType image/gif M31556000
ExpiresByType image/jpeg M31556000
ExpiresByType image/png M31556000
ExpiresByType text/css M31556000
ExpiresByType text/javascript M31556000
ExpiresByType application/javascript M31556000
ExpiresByType application/x-javascript M31556000
ExpiresByType text/xml M31556000
ExpiresByType image/svg+xml M31556000
ExpiresByType application/x-font-ttf M31556000
ExpiresByType application/x-font-truetype M31556000
ExpiresByType application/x-font-opentype M31556000
ExpiresByType application/vnd.ms-fontobject M31556000
ExpiresByType application/x-font-woff M31556000
</IfModule>
# For servers that support output compression, you should pick up a bit of
# speed by un-commenting the following lines.
php_flag zlib.output_compression On
php_value zlib.output_compression_level 9
While the images pull in just fine, none of this caching is gettting applied to the images being pulled in. I have even added this same .htaccess to the /the/real/location/wp-content/uploads/
and there is no difference.
What can I do to make sure that these .htaccess settings are effective for every file/sub-folder residing in: /the/real/location/wp-content/uploads/
?
Upvotes: 0
Views: 146
Reputation: 26
I checked out the Apache Manual here,
http://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias
So it says the Alias directive can only be used in server configuration or a virtual host, and not allowed in a .htaccess file.
Always try to look at the third line of any directive description in the manual, the line beginning with "Context: . . ." since it tells you where you can use (and by omission where you can't use) the item being described.
Upvotes: 1