I recently built a netherportal on my minecraft realm and enclosed it for pigmen security. Once going through and coming back I realised I hadn't spawned back at my base but in a remote location nearby. I decided to completely destroy the enclosed area and rebuilt the netherportal to test again, it kept spawning me in remote area nearby. No matter what I do it won't spawn me back at my base. I have attached screenshots below to provide visualization. First time I have came across this issue, so if there is a way of rectifying it please don't write hate comments, just inform me please.
Related issues
Attachments
Comments


Please provide the coordinates of all the portals.
Portal 1 coordinates - x=(-273.469)/y=(63)/z=(317.145)
Netherworld Portal coordinates - x=(18.109)/y=(74)/z=(39.254)
Portal 2 coordinates - x=(-159.046)/y=(70)/z=(311.500)

As far as I can tell, the behaviour you describe is intended. Portals connect to the nearest portal in the opposite dimension, at a 1:8 ratio.
If you take the nether portal coordinates, and multiply by 8, you get: x=(144),y=(74),z=(312).
As this location is closer to portal 2 than portal 1, it connects to the second one.
Interesting, because where portal 2 is located I never built one there. Everytime I come back from the Netherworld it keeps spawning the portal for me in that particular location, even after I have destroyed portal 2. So what I am trying to find out is why is the game randomly spawning a portal in the normal world everytime I come back? I will do another test and build my main portal across a biome and see if that does the trick, if not I assume it's a bug.
Okay I went across an entire biome and tried again x=(-1011)/y=(74)/z=(357) it still spawns me in same area within the Netherworld, and when I came back through it spawned me at portal 2 again :/. From what I remember when I first logged into my realm it was around the area where portal 2 is located not sure that'll help with anything.

In that case this is a duplicate of MC-1403, which works as intended. You may want to take a look at the minecraft wiki about how nether portals connect.
Ahhh thankyou! I managed to fix the problem. I had to rebuilt a new portal in netherworld using calculations from the coordinates in the overworld by dividing x and y by 8. Also I found this video on Youtube which was very handy https://www.youtube.com/watch?v=woPASE9fmjc.