nginx rewrite rule under a subdirectory

前端 未结 1 910
我在风中等你
我在风中等你 2021-01-12 06:18

I have a WordPress site running nginx under a sub-direcotry. how can i write rewrite rules in a sub-directory? or can anyone please convert this Apache rewrite rule? I searc

相关标签:
1条回答
  • 2021-01-12 06:53

    try to use this, and please don't forget to replace root path!

    location /main/ {
       root /full/path/from/root/main/;
       try_files $uri $uri/ /index.php?$args;
    }
    

    I've set wordpress on my host in folder /main and got it's working with next settings:

    location /main {
            index index.php;
            try_files $uri $uri/ /main/index.php?q=$uri;
    }
    root /path/to/webroot;
    
    0 讨论(0)
提交回复
热议问题