1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: site root links not working.

Discussion in 'Web Design & Development' started by CilVine, Apr 8, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. CilVine

    CilVine Thread Starter

    Joined:
    Apr 7, 2013
    Messages:
    48
    I am currently using wampserver (set up an alias instead of putting my site in the www folder).

    I recently saved some images with the "/" at the bginning (eg. /a folder/the image.png), meaning that I made them root-relative. I use Dreamweaver for sorting the files out, but normally hand-code.

    The when I tried to view my page in Dreamweaver's design view, all I saw were broken links. Relative links work, but site-root relative ones aren't working.

    I read, somewhere, that when you link images to the site root, they actually link to the root of the drive the site is on, rather than the Dreamweaver defined root. Is that so?

    How do I sort this issue out?

    Thanks.
     
  2. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    Option 1: Create a little partition for holding the site.
    Option 2: Do all your testing in a local server such as Wamp (such that the www folder then becomes the root).
    Option 3: Use relative links.
    Option 4: Use hard absolute links to the actual location on the hard drive, and then use find and replace.
     
  3. CilVine

    CilVine Thread Starter

    Joined:
    Apr 7, 2013
    Messages:
    48
    THANKS FOR REPLYING, ENT,

    I understand the pointd you are making.

    However, relative links are a problem if you are using php includes for most pages, right? If it weren't for the need to use Includes, I would have settled for relative links (unless you know of a work-around that I don't).

    I was trying to avoid using absolute links, but they sem to be the best work-around, right now. Are they not a bit of a disadvantage performance wise, though?

    I am using wamp as my local server, but I set up an alias on my removable hard disk drive for portability's sake, because I may be using more than one macjine in a few months' time.

    I think option 4, is the only one that may give me less work. But, I would have replace (or take off) the "localhost" part when going live.
     
  4. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    PHP includes wouldn't be my big reason for using root-relative links. Indeed from PHPs perspective the root is the root of your filesystem, not of your domain, so you risk introducing more confusion with that approach.
    My concern would be having common access to other resources, such as images and css files, if you have your HTML scattered amongst different folders. If they're all in the same folder, there isn't really any advantage.
     
  5. CilVine

    CilVine Thread Starter

    Joined:
    Apr 7, 2013
    Messages:
    48
    Yep. You're right.

    The only thing is that I am a bit of a writing bee. I have hundreds of articles, images, and so forth, right from the off. Therefore, a well thought out file structure is needed. Which is why I am pining over this issue.

    There will be quite a few different categories that would require their own folders, whilst sharing a single page design|layout (obviously).

    Therefore, I seem to feel as if your last point would be easiest for me, and easiest to re-adapt to new environments. I am not to worried about putting in a little extra code. My main concern is the good efficiency and automation of processes.

    At first, I didn't get your fourth point, when you mentioned "then use find and replace". Then, I thought "hold on a minute, thats sound like what I'd do using a text editor!". Never thought of that (nor heard much about it).

    Thanks.
     
  6. CilVine

    CilVine Thread Starter

    Joined:
    Apr 7, 2013
    Messages:
    48
    One more thing, though, Ent.

    The other disadvantage with absolute links is that they become problematic for someone who wishes to view my files offline (is that so?). However, I hear that opposite applies for pdf files. It is better to use absolute links with Pdfs.
     
  7. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    I use notepad++ for my web design, and it lets you do a find and replace over all the files in a folder.
    Alternatively if you're using something like dreamweaver, you should be able to adjust a template and change all the files. I couldn't say exactly how as I don't use it myself.

    The ideal, however, would probably be some sort of CMS. If you were working in Wordpress, or indeed in your own site which uses PHP to populate the page with the story, you wouldn't need to worry about organizing things at the folder level.


    Yes, I can see how absolute links would annoy people who're trying to save the page. It's not my first concern, but I guess it depends on what your site is aimed at.
     
  8. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    Translation?
     
  9. CilVine

    CilVine Thread Starter

    Joined:
    Apr 7, 2013
    Messages:
    48
    Yep.

    I use notepad++ a little myself. It does come in handy quite often.

    As an aspiring web-dever, I am delving into other forms of getting things done (using CMSs and my php framework, for example).

    I don't want to rely too much on Dreamweaver. Which is why I css and html mostly by hand, and I do not use .dwt (Dreamweaver templates). Sometimes, in making things a little 'simpler', or automated, the programme actually makes things harder for you, because, in this profession, a knowledge and understanding of the background processes is priceless. However, in terms of file and site organisation and structure, it is okay, because it helps keep your files and folders in check.

    I will stick with notepad++ and (for example) php. These are more universal, and, if in future, someone else joins me in my work, it could be easier for them to hit the ground running.

    Thanks for the correspondence, though. I shall mark this post as solved. (At least for now)
     
  10. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1095515

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice