Hoping someone can give me some advice

First 301 redirect I'm having to set up so I hope I'm not complicating this too much. Sorry if its a bit drawn out.

We have 2 domains that I would like to all point to the same domain and by the looks of it a 301 redirect will be the way to go for SEO etc.

Our main website is held on a server with a host that doesn't want me to have a test area on their server


The other domain (and different host) is where I can have a test area but it also used to be where we had our main site until we moved it over to the other host.


I would like to redirect www.anotherdomain.com (because it has some SEO value) but would also still like to be able to use the testarea for myself.

So can I put a 301 on www.anotherdomain.com but still allow myself access to the testarea without it getting redirected?

Also apologies if I am missing the concept of this redirect technique.