Setting Up 301 Redirect to Another Domain Name with Nginx in Directadmin

By | February 5, 2020

Sometimes all you need to do is to redirect customers to another domain, with same query he had. It is easy to do with .htaccess if you have Apache, but if you have nginx, you have to ask your server administrator to do that.

If you are a server administrator, here’s the trick:

Log in as admin, go to Custom HTTPD Configurations.

Choose the domain name you need

In the very first section add this line:

|*if SSL_TEMPLATE=”0″|
return 301 https://www.newdomain.com$request_uri;
|*endif|

Replace newdomain.com with your own domain, and hit Save. That’s all! Wait for nginx to reboot, and now you should be able to get it working!

Leave a Reply

Your email address will not be published. Required fields are marked *