The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End preventing links from going to server root

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #26293

    I am currently working on a basic site using PHP includes that I am testing locally using MAMP. I am not using dreamweaver so I don’t have the luxury of auto updating links when I transfer to a server.

    The problem is I work on the site locally and it works fine. But when I upload it to all of my links break because I am using links such as href="/img/image-name.jpg".

    How would I prevent the link from going to my domains server root and just stay inside the folder. Is this something an .htaccess file would do? If so could someone explain how that works?

    Much appreciated!


    If you’re using relative links, and the structure is the exact same on live as it is locally, you should be having no problems like that.


    Hey TheDoc. Thanks for the reply. Unfortunately that is exactly the problem the folder structure is different. Let me add more detail.

    Point A.
    I am a freelancer and create multiple sites so I need a folder on my website to place multiple jobs so for example.

    Point B.
    domain root/_clients/job1
    domain root/_clients/job2
    domain root/_clients/job3

    I send the client the link above to review the design. But the problem arises when I have links like. /img/image.jpg because it travels all the way to the domian root folder. What I need is a way to say hey stop here at job1 and get the img folder.

    Point C:
    and then when the client approves the design I need to take the approved job and put it to their server.

    So point A and point C are the same. But when I load it to my client folder on my site the links break.

    Thank you for helping.


    That is very strange, it shouldn’t be going all the way to the root folder unless it has "../" in front of it.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.