Apache开启Rewrite,expires和Gzip

Rewrite规则开启,vi /etc/httpd/conf/httpd.conf找到并修改以下规则:

Options FollowSymLinks
AllowOverride None(修改为AllowOverride All)
Options Indexes FollowSymLinks MultiViews
AllowOverride None(修改为AllowOverride All)
Order allow,deny
allow from all

Gzip开启,在httpd.conf当中输入

<IfModule mod_deflate.c>
DeflateCompressionLevel 5
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-javascript application/x-httpd-php
AddOutputFilter DEFLATE js css
</IfModule>

expires开启

 

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 12 month"
ExpiresByType text/html "access plus 12 months"
ExpiresByType text/css "access plus 12 months"
ExpiresByType image/gif "access plus 12 months"
ExpiresByType image/jpeg "access plus 12 months"
ExpiresByType image/jpg "access plus 12 months"
ExpiresByType image/png "access plus 12 months"
EXpiresByType application/x-shockwave-flash "access plus 12 months"
EXpiresByType application/x-javascript "access plus 12 months"
ExpiresByType video/x-flv "access plus 12 months"
</IfModule>

当然前提是rewrite,expires,defalte模块存在

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据