301 redirect from olddomain.com to newdomain.com

Hello,

I want to change my olddomain.com to newdomain.com. Here’s what I did. I setup a new server with newdomain.com. I want to redirect permanently olddomain.com to newdomain.com. Both servers are using easyengine. What’s the best way to redirect my olddomain to my newdomain permanently using NGINX? Thank you!

Hi @seyntjim,

You have add nginx configuration on old server. edit nginx configuration by usnig following command and add below line into it.

ee site edit old-domain.com

add this to nginx config

server {

listen 80;
server_name olddomain.com;
return 301 $scheme://newdomain.com$request_uri;

}

Hello @shitalpatil,

Thank you so much. A friend also gave me this code

rewrite ^ $scheme://www.example.com$request_uri permanent;

I was just wondering which do you think is better. Thanks!

Hi @seyntjim

You may refer this for your query.

Incase the link goes down, following is the gist:

REWRITE
========
1. Only the part of the original url that matches the regex is rewritten.
Slower than a Return.
2. Returns HTTP 302 (Moved Temporarily) in all cases, irrespective of permanent.
3. Suitable for temporary url changes.

RETURN
=======
1. The entire url is rewritten to the url specified.
2. Faster response than rewrite.
3. Returns HTTP 301 (Moved Permanently).
4. Suitable for permanent changes to the url.
5. No need to set  permanent.

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile:

1 Like