.htaccess更改未生效

时间:2018-12-08 00:22:56

标签: .htaccess

我的客户刚刚注册了亚马逊虚拟服务器。在上线之前,我们正在运行测试环境,并将其主网站复制到新服务器上的子域中,以便进行测试。我对安装了wordpress的子域目录中的.htaccess文件进行了一些更改,但是更改未生效。我添加了到期标头和文件压缩,以阻止Google Page Insights和GTMetrix抛出有关杠杆浏览器缓存的错误,但是每次我在两个站点上测试该错误时,它们都保持不变,就好像该文件未在使用中或正在使用中一样。错误的位置。实际上,当我查看google页面见解的缓存过期时,它表明htaccess文件将它设置为一个月时,我没有为js或css设置过期。我正在使用Comet Cache插件,该插件将设置为每7天过期一次,但是我没有专业版,也没有在使用杠杆浏览器缓存选项。

我的.htaccess文件:

<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$">
Header always set Cache-Control "max-age=691200, public"
</filesMatch>

# Fonts
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot 
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg

<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 video/mp4 "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresDefault "access 2 days"
</IfModule>


<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

Here's a screenshot of filezilla so you can see the directories

当将https://dev.advantageits.com/插入google page insights时,即使在.htaccess文件中设置了到期时间,也会得到a list of files with no expiration

那么这是怎么回事?

我的htaccess文件中需要重定向吗?我不知道为什么这些更改都不起作用。

0 个答案:

没有答案