Redirect nginx将所有请求重定向到root,除非它';根

Redirect nginx将所有请求重定向到root,除非它';根,redirect,nginx,rewrite,Redirect,Nginx,Rewrite,我需要将所有永久请求(例外情况除外)重定向到根目录/它将在那里提供文件whatever.html .即 有什么想法吗 All should give 301 permanent to / http:://www.domain.tld/whatever/anything/realy == 301 ==> http://www.domain.tld http:://www.domain.tld/blabla == 301 ==> http://www.domain.tld http:

我需要将所有永久请求(例外情况除外)重定向到根目录/它将在那里提供文件whatever.html

.即

有什么想法吗

All should give 301 permanent to /
http:://www.domain.tld/whatever/anything/realy  == 301 ==> http://www.domain.tld
http:://www.domain.tld/blabla  == 301 ==> http://www.domain.tld
http:://www.domain.tld/ == 301 ==> http://www.domain.tld

except for
http://www.domain.tld/special.html == serve ==> special.html


root should serve the defailt file (as specificed in index)
http:://www.domain.tld  == serve => somefile.html