如何修复“ mod_rewrite.c”文件中的浏览器缓存过期?

时间:2019-10-03 01:43:11

标签: php regex wordpress

我正在尝试为网站设置浏览器缓存。谁能指导我在哪里设置过期代码?

我需要将这些代码放在“ .htaccess”文件中进行缓存,

<IfModule mod_expires.c>
    ExpiresActive On
    # Images
        ExpiresByType image/jpeg "access plus 1 year"
        ExpiresByType image/GIF "access plus 1 year"
        ExpiresByType image/png "access plus 1 year"
        ExpiresByType image/webp "access plus 1 year"
        ExpiresByType image/svg+XML "access plus 1 year"
        ExpiresByType image/x-icon "access plus 1 year"
    # CSS, JavaScript
      ExpiresByType text/css "access plus 1 month"
      ExpiresByType text/JavaScript "access plus 1 month"
      ExpiresByType application/JavaScript "access plus 1 month"
</IfModule>

This is my code found in .htaccess file in root directory, 

# BEGIN WordPress
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>

# END WordPress

0 个答案:

没有答案