nginx redirect loop, remove index.php from url

前端 未结 5 1355
长情又很酷
长情又很酷 2020-11-29 03:25

I want any requests like http://example.com/whatever/index.php, to do a 301 redirect to http://example.com/whatever/.

I tried adding:

5条回答
  •  遥遥无期
    2020-11-29 03:59

    Try that

    location ~ /*/index.php {
        rewrite ^/(.*)/(.*) http://www.votre_domaine.com/$1 permanent;
    }
    location /index.php {
        return 301 http://www.example.com/;
    }
    

提交回复
热议问题