Relative path links in Wamp?

Ran into snag. My relative links in my php includes are not resolving correctly testing in Wamp. Live on my hosts server simply begining the url with “/” works perfect (eg /img/test.jpg). But not so in Wamp. I havn’t tested this yet but I imagine if I were to use an absolute path or possibly my local directories full path (aka my computers path) it would work correctly. This is obviously not the optimal solution. Currently I have my site set up as an alias in Wamp. This works perfect aside from the above issue. Is there anyway to resolve this? Doing lots of googling it seems to all point to setting up a virtual host. Would that resolve the relative links issue? Although I would prefer to keep it an alias since it’s already setup that way. But I’ll do what’s necessary to fix. Thanks!

You could take a look at html’s <base> tag

<base href=“/mywebsite”>

or did I understand your question wrongly? If so, please post a bit more info on the URLs you’re using locally and the URLs you’re using online.

BTW. An URI starting with a / is absolute, those not starting with a slash are relative

True. Thanks! I’ve never heard of base. I’ll look into that. The links are nothing special. Just a standard include and within the include (this one at least) is an img with a src=“/images/test.jpg”. This works on Hostgator but not on Wamp. If I structure the link relative and leave off the slash (eg src=“images/test.jpg”) then as expected in Wamp it works on root level files but none non root level.

Lol. I’ve read a few hundred threads of people explaining their file structure today. Mine is prob no better.

That was a bit over my head. I literally read all day on my phone. Used a few hundred different search terms. It finally led me too needing to setup a Virtual Host. I followed this tut and now my links work exactly the same on my local testing as they do on my remote server.