search

Home  >  Q&A  >  body text

nginx regular matching problem

location / {
    index   index.html index.htm index.php;
    rewrite ^/(.*)$ /index.php?/;
}

The regular part of the configuration file is as above, but files ending in .css and .jpg have also been rewritten. How can I block it?

怪我咯怪我咯2748 days ago562

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:31:13

      location / {
                       if (!-e $request_filename){   
                            rewrite ^(.*)$ /index.php?s=/ last; #rewrite模式   
                            rewrite ^(.*)$ /index.php/ last; #pathinfo模式 任选其一   
                        }   
                  } 

    reply
    0
  • Cancelreply