php - how to exclude domain from Wordpress links?

I have a Wordpress site where all menu links don't have domain (as they should be):

https://ec2-18-169-0-22.eu-west-2.compute.amazonaws.com/

Example:

<a href="/contactos/">Contacto</a>

I'm creating a brand new Wordpress site to replace it, but this new site has all links with the domain:

http://ec2-52-47-81-131.eu-west-3.compute.amazonaws.com/

Example:

<a href="http://ec2-52-47-81-131.eu-west-3.compute.amazonaws.com/blog/">Blog</a>

in both cases, in wp-config.php I have:

define( 'WP_HOME', 'http://ec2-xx-xx-xx-xx.eu-west-3.compute.amazonaws.com/' );
define( 'WP_SITEURL', 'http://ec2-xx-xx-xx-xx.eu-west-3.compute.amazonaws.com/' );

I wonder if there's a Wordpress configuration that allows to remove domain from the links.

Answer

Solution:

I ended up using the Wordpress Make Paths Relative: https://wordpress.org/plugins/make-paths-relative/

it solved all my problems

Source