Spis treści

nginx rewrite wordpress

Wpisy które zmuszą naszego wordpressa do poprawnego wyświetlania linków.

        location / {
            try_files $uri $uri/ /index.php?$args;
        }
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires 24h;
            log_not_found off;
        }
        rewrite /files/$ /index.php last;
        set $cachetest "$document_root/wp-content/cache/ms-filemap/${host}${uri}";
        if ($uri ~ /$) {
            set $cachetest "";
        }
        if (-f $cachetest) {
            rewrite ^ /wp-content/cache/ms-filemap/${host}${uri} break;
        }
        if ($uri !~ wp-content/plugins) {
            rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
        }
        if (!-e $request_filename) {
            rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
            rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
            rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
        }

nginx rewrite dla Dokuwiki w podkatalogu ( jak tutaj )

  # wiki dokuwiki

    location /wiki {
    index doku.php;
    try_files $uri $uri/ @dokuwiki; }
    location @dokuwiki {
        rewrite ^/wiki/_media/(.*) /wiki/lib/exe/fetch.php?media=$1 last;
        rewrite ^/wiki/_detail/(.*) /wiki/lib/exe/detail.php?media=$1 last;
        rewrite ^/wiki/_export/([^/]+)/(.*) /wiki/doku.php?do=export_$1&id=$2 last;
        rewrite ^/wiki/(.*) /wiki/doku.php?id=$1&$args last;
    }
      location ~ /wiki/(data|conf|bin|inc)/ {
      deny all;
    }

rerwite z www

rewrite na https z request uri

rewrite ^ https://$http_host$request_uri;