XAMPP setep - Having issues with links

Hello. So im attempting to setup a local environment on my computer for quicker wordpress development. However im running into an issue, which i now realise did not fix when i out of frustration uninstalled WAMP and then installed XAMPP.

When i put my website in the htdocs folder, it looks like this... localhost/mywebsite/

Now mywebsite loads perfectly fine. Im able to see the content. however then, when i click on 'contact' or another menu item, instead of taking me to localhost/mywebsite/contact/ it takes me to localhost/contact/ which of course is not a valid page as its now OUTSIDE the document root.

How can i fix this so that my website always points to the root? and any links i follow then take me to from the root of the installation to the page?