Nginx

NGINX wordpress rewrite

by Luatic™ posted Jul 25, 2014
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

+ - Up Down Comment Print
Extra Form

conf 폴더에 wordpress.conf 를 만듭니다. 내용은 아래와 같이 추가

# enforce NO www
    if ($host ~* ^www\.(.*))
    {
        set $host_without_www $1;
        rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
    }
 
    # canonicalize codeigniter url end points
    # if your default controller is something other than "welcome" you should change the following
    if ($request_uri ~* ^(/welcome(/index)?|/index(.php)?)/?$)
    {
        rewrite ^(.*)$ / permanent;
    }
 
    # removes trailing "index" from all controllers
    if ($request_uri ~* index/?$)
    {
        rewrite ^/(.*)/index/?$ /$1 permanent;
    }
 
    # removes trailing slashes (prevents SEO duplicate content issues)
    if (!-d $request_filename)
    {
        rewrite ^/(.+)/$ /$1 permanent;
    }
 
    # removes access to "system" folder, also allows a "System.php" controller
    if ($request_uri ~* ^/system)
    {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }
 
    # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
    if (!-e $request_filename)
    {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }


워드프레스가 설치되는 도메인의 하단 } 위에 include /경로/wordpress.conf; 추가 하시면 됩니다.