Heim  >  Fragen und Antworten  >  Hauptteil

Was bedeuten diese Sätze über die Implementierung von Rewrite durch Nginx?

    if (-f $request_filename/index.php){
            rewrite (.*) /index.php;
    }
    if (!-f $request_filename){
            rewrite (.*) /index.php;
    }
某草草某草草2734 Tage vor543

Antworte allen(1)Ich werde antworten

  • 黄舟

    黄舟2017-05-16 17:15:51

      if (-f $request_filename/index.php)
    #如果存在文件$request_filename/index.php
    {
                rewrite (.*) $1/index.php;
                #那么执行这条 rewrite
                # $1代表上面if里匹配的
        }
        if (!-f $request_filename){
        #如果不存在文件$request_filename
                rewrite (.*) /index.php;
                #那么执行这条 rewrite
        }

    Antwort
    0
  • StornierenAntwort