0

I am running wamp on my pc, with more than one project, so in order to go to my project I need to go to localhost/project1 and it works fine however href links (/mypage.html) keep pointing to localhost/mypage.html.

What do I need to change in order to keep the links in my project path?

Brian
  • 14,610
  • 7
  • 35
  • 43
dsadasc
  • 13
  • 8

2 Answers2

1

First of all it is always better to create different virtual hosts Please refer this link to do the same https://www.kristengrote.com/blog/articles/how-to-set-up-virtual-hosts-using-wamp

OR

use href links as (mypage.html) or (./mypage.html) which will add mypage.html to your last trailing "/" in url

Kailash Yadav
  • 1,880
  • 2
  • 18
  • 37
0

Use an absolute link in the form of href="/project1/mypage.html" or use a relative link of the form href="mypage.html" or href="./mypage.html".

A link with a leading slash is usually interpreted as an absolute link, beginning from the server's root. In contrast, omitting the slash links relatively. A leading dot with a slash makes this even more explicit, saying "relative to the current path".

See also this SO post for a more detailed explanation.

Community
  • 1
  • 1
sebastian_oe
  • 7,186
  • 2
  • 18
  • 20
  • I can't link to my project this is a dev site , and the production site does not have constant name. Can I make my project my home page from the Apache setting? – dsadasc Apr 29 '15 at 18:13