Configuring Next.js app for redirection while whitelisting specific IPs.
Configuring Next.js app for redirection while whitelisting specific IPs.
Below is the code that enables the execution of a Next.js application for specific IP addresses while redirecting other users to the primary website.
#RewriteEngine On
## WH
RewriteCond %{REMOTE_ADDR} !10\.10\.10\.10$
RewriteCond %{REMOTE_ADDR} !11\.11\.11\.11$
RewriteRule ^(.*)$ https://www.live-website.com/$1 [L,R=301]
DirectoryIndex
RewriteEngine On
RewriteBase /
RewriteRule ^media/(.*)$ https://api.newwesite.com/media/$1 [R=302,NC,L]
RewriteRule ^paypal/(.*)$ https://api.newwesite.com/paypal/$1 [R=302,NC,L]
RewriteRule ^(.*)?$ http://127.0.0.1:3002/$1 [P,L]