Skip to main content

nextjs

NextJs htaccess setting

The content of the .htaccess for nextjs application is

# Redirect traffic to your port 3001
DirectoryIndex
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)?$ http://127.0.0.1:3001/$1 [P,L]
 

to exclude a file from this rule (EX: test.txt) we can add this like 

RewriteCond %{REQUEST_URI} !test\.txt [NC]

 

Full Code