Wordpress

Wordpress: Правила для .htaccess

ADVERTISEMENT

При правильном использовании, конфигурационный файл web-сервера Apache — .htaccess (hypertext access) представляет собой очень мощное средство в инструментарии разработчика. По-обыкновению, основной файл располагается в корневой директории вашего web-сервера (также могут присутствовать отдельные файлы в каждой папке — для управления доступом) и может быть откорректирован с помощью любого текстового редактора.

ADVERTISEMENT
# 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
#
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
<ifmodule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_item_include file .js$
mod_gzip_item_include file .css$
</ifmodule>
</IfModule>
#
<ifModule mod_headers.c>
Header unset Last-Modified
</ifModule>
#
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 7 days"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/html "access plus 7 day"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
</IfModule>
#
# Cache-Control
<ifModule mod_headers.c>
# 30
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

# 30
<filesMatch ".(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

# 2
<filesMatch ".(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesMatch>

# 1
<filesMatch ".(html|htm|php)$">
Header set Cache-Control "max-age=172800, private, must-revalidate"
</filesMatch>
</ifModule>

ADVERTISEMENT
Подписаться
Уведомить о
guest

0 Comments
Межтекстовые Отзывы
Посмотреть все комментарии