在我当前的lightspeed服务器中,我使用以下代码将/path/index.html
用于/pathg/
或/path/example.html
至/path/example/
# to make `/path/index.html` to /path/
RewriteCond %{THE_REQUEST} ^GET\s(.*/)index\.html [NC]
RewriteRule . %1 [NE,R=301,L]
RewriteCond %{THE_REQUEST} ^GET\s.+\.html [NC]
RewriteRule ^(.+)\.html$ /$1 [NE,R=301,L,NC]
RewriteCond %{REQUEST_URI} !\.html$ [NC]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule . %{REQUEST_URI}.html [L]
# to make `/path/index.php` to /path/
RewriteCond %{THE_REQUEST} ^GET\s(.*/)index\.php [NC]
RewriteRule . %1 [NE,R=301,L]
RewriteCond %{THE_REQUEST} ^GET\s.+\.php [NC]
RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC]
RewriteCond %{REQUEST_URI} !\.php$ [NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule . %{REQUEST_URI}.php [L]
有没有人知道如何使用nginx实现相同的目标?