• Nginx Wordpress Rewrite Rules

rewrite !\.(js|ico|gif|jpg|png|css|pdf|mov|mp3|eot|svg|ttf|woff|otf|txt|swf)$ /index.php break;

# uncomment if you want to force HTTPS
#if ($ssl_protocol = "") {
#rewrite ^   https://$server_name$request_uri? permanent;
#}

# Wordpress permalinks
if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php?q=$1 last;
    break;
}

# enable gzip compression
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_comp_level 6;
#gzip_comp_level 9;
gzip_min_length  1100;
gzip_buffers 16 8k;
gzip_proxied any;
# gzip_http_version 1.1;
gzip_types       text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss application/javascript
;
# end gzip configuration

location ~* ^/(.*\.(js|css|png|jpg|jpeg|gif|ico))$ {
    expires 2w;
    log_not_found off;
}

This article was last modified: March 2, 2017, 12:35 p.m.

0 Comments

Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.

Share

Hacker News

Top