They're not ignoring the base href, you need to go up one level. You could try the unix shorthand with the 2 periods. In
http://mydomain.com/x your relative link to Y.php would be ../Y.php
In other words, your base href is appended to the current directory, X. A relative link in X would be appended to the base href + the current directory, thus
http://mydomain.com/X/Y.php. If Y.php was inside X, everything would be fine, but if it is in mydomain.com along with X and others, you need to go up one level.