因此,由于我将博客托管在与我的网站相同的服务器上,我想我会创建一个别名,以便我可以提取我的投资组合。
Alias /port-images/ /the/real/location/wp-content/uploads/
在我的博客和网站中,我将图像拉入包含以下 .htaccess 代码:
# 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
虽然图像拉入得很好,但这些缓存都没有应用于被拉入的图像。我什至将相同的 .htaccess 添加到/the/real/location/wp-content/uploads/
并没有区别。
我可以做些什么来确保这些 .htaccess 设置对驻留在以下位置的每个文件/子文件夹都有效:/the/real/location/wp-content/uploads/
?