Nginx Redirect From a Website to Another Website

Posted on May 26, 2019 at 5:00 pm

This Nginx config can redirect your website to another website:

server {
        listen 80;
        server_name website.com www.website.com;
        access_log /var/www/website.com/logs/access.log main;
        error_log /var/www/website.com/logs/error.log warn;
	root /var/www/website.com/htpdocs;
	index index.html index.htm index.php;
 
        return 301 http://www.newsite.com$request_uri;
}

Useful if you moved your website.

Receive updates via email

Other Posts

Updated Posts