Next.js: Difference between revisions

Line 10: Line 10:
davidl.me {
davidl.me {
   root * /var/www/davidl_me/out
   root * /var/www/davidl_me/out
  @pathWithSlash path_regexp dir ^(.*)/$
  redir @pathWithSlash {re.dir.1}
   try_files {path} {path}.html
   try_files {path} {path}.html
   file_server
   file_server
Line 17: Line 15:
</pre>
</pre>


* You can also use <code>uri strip_suffix /</code> instead of the redirect.
If you have folders with the same names as pages, you may want to remove trailing slashes:
<pre>
# Using a redirect
@pathWithSlash path_regexp dir ^(.*)/$
redir @pathWithSlash {re.dir.1}
# Using a rewrite
uri strip_suffix /
</pre>