301 redirect external bought domain subpages to homepage of my site



I have a site set up with Nginx and EasyEngine. Let’s say that my domain is example.com

Now, I have registered an expired domain with a good SEO profile, and I want to make sure that all of the subpages of the expired domain point to my homepage. Let’s call the expired domain newdom.com

What I have so far is the following:

server { server_name newdom.com www.newdom.com; location / { return 301 $scheme://convertitoreyoutube.it; } }

server { server_name www.example.com; return 301 $scheme://example.com$request_uri; }

So, what’s happening now is I’m getting my www redirected to non-www like I want. But when it comes to the new domain, if I go to www.newdom.com/whatever.php or any other subpage, I get redirected to example.com/whatever.php

What I’d like is for every subpage to redirect to my site’s homepage. i.e. www.newdom.com/whatever.php -> example.com

I tried with rewrites, with locations, and a bunch of other stuff… but still no go. The domain is 301 redirected to my site via the GoDaddy DNS panel. Could this be the problem? Should I just add an A record instead and do all the redirecting on the server?

I hope this makes sense, and sorry if it’s a stupid question!

Thanks in advance!