Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    local root webpage url paths issues

    I have a problem. I want to end up with only root path urls in my webpages(eg img src="/images/image.jpg") as opposed to relative paths(img src="../../images/image.jpg"). When browsing my site on the server once, I found lots of extra "///" characters in the address bar which I believe is because I used "../" in my url's, this is one of the reasons I want root paths. And also of course, if I change position of the page in the directory structure, I would have to change all relative paths.
    So why cant I just use root paths? Simply becuase unless I upload it to my server, webpages will not display correctly on my computer becuase I cant set a root directory for my browsers.
    Is there any software I can use to set a pseudo-server on my computer which will set a root directory for all browsers? Or are there any firefox/ie plugins that will accomplish this?
    I was wondering how other designers deal with this issue. Right now I just manually edit the css style and image paths, links to other local pages I leave as root paths, which means I cant browser them unless I upload them to my server.
    I will try writing a script to automatically change all "../../../" in my pages to just "/", which would solve the problem of editing relative to root, but I would still have all the other issues I mentioned above.
    Any ideas are appreciated.

  • #2
    New Coder
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I forgot to mention absolute paths, if I upload all files to my server I could use an absolute http path for all my links but I am not sure if it is good practice. And also no one would be able to browse the website offline.
    Another question, which paths are best for SEO? Relative, Root, Absolute? Or does it not matter?

  • #3
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    IICR, "///" means it is a local file external to the web processing.

    Do you have code we could look at?

    Generally, you use relative paths ("/images/some.img") so that if you move the root somewhere, it's not affected. If you hard code the root, then you are bound to it.
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • #4
    New Coder
    Join Date
    Sep 2007
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When I uploaded the files to my webhost, I had parent relative links starting with "../../" which caused the "///" in the url bar...... I have decided to use root links for everything "/images/image.jpg, /layout/styles.css", so if I move the files around, then I wont have to change the links.

    Problem is, I can not view links starting with only "/" on my computer locally..... so I installed apache server, but I do not know how to set it up....

    I have read apache docs.

    I have entered document root:
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
    DocumentRoot "C:/operator1/oex-onmedias/primary"

    So now apparently, when I type "http://www.onmedias.com/" in my browser, it would display C:/operator1/oex-onmedias/primary/index.html, but it does not work! Why?

    Another question, how would I then be able to browse my actual website on my web host after I have uploaded it to my online server if the url is the same? it would only take me to the local server.

    Last question, how would I set up multiple local websites on apache? Do I need to do a new apache install for each website? Or if not, how do I divide doc-root urls and domains of multiple sites in my config file?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •