[フレーム]
Last Updated: February 25, 2016
·
1.047K
· maxcnunes

Redirect a page with nginx

Add this into your conf file (e.g., sudo nano /etc/nginx/conf.d/my_domain.com.conf):

rewrite YOUR_OLD_URL YOUR_NEW_URL permanent;

For example, redirect the page br.html to the base url:

server {
 listen 80;

 server_name my_domain.com;

 location / {
 proxy_pass http://localhost:8000;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection 'upgrade';
 proxy_set_header Host $host;
 proxy_cache_bypass $http_upgrade;

 rewrite /br.html / permanent;
 }
}

In my case this redirect was parmanent, but you could change to permanent key word to redirect if it is just temporary.

AltStyle によって変換されたページ (->オリジナル) /