Nginx rewrite rule for CodeIgniter

前端 未结 3 1490
抹茶落季
抹茶落季 2021-02-03 14:09

Here is the rule in English:

Any HTTP request other than those for index.php, assets folder, files folder and robots.txt is treated as a request for your

3条回答
  •  不思量自难忘°
    2021-02-03 14:39

    You can add this to your config:

    location ~* ^/(assets|files|robots\.txt) { }
    

    This will work correctly with your location / rule.

    Your config also need to add root document and default index file.

    ...
    root /ftp/wardrobe;
    index index.php index.html index.htm;
    
    location / {
        try_files $uri $uri/ /index.php?/$request_uri;
    }
    
    location ~* ^/(assets|files|robots\.txt) { }
    ...
    

提交回复
热议问题