SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Nov 2000
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Relative & Abosolute Links

    Hi all,

    Wonder if anyone has a solution to my problem here.

    I've got an Intranet site with a few thousand pages and this is stored on a shared drive on the local file server. We may be moving this to a web server soon and we may have a problem because not all the links were made relative. So there are about 850 links that start

    <a href="file:

    I can do a find and replace but the problem is that not all the pages are in the same place...Is there a simple way of changing the links to relative while maintaining a valid link?

    E.g. current link is <a href="File:///C:/My Documents/mylinkedpage.html>click here<end tag>

    The link it should be is: <a href="../../../my documents/mylinkedpage.html>click here<end tag>

    I'm guessing that it will have to be a manual process but hopefully someone will prove me wrong and come up with some amazing way of doing it ?

    Cheers

  2. #2
    Forensic SEO Consultant Webnauts's Avatar
    Join Date
    Jun 2003
    Location
    European Union
    Posts
    1,488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tezdread
    Hi all,

    Wonder if anyone has a solution to my problem here.

    I've got an Intranet site with a few thousand pages and this is stored on a shared drive on the local file server. We may be moving this to a web server soon and we may have a problem because not all the links were made relative. So there are about 850 links that start

    <a href="fileBR><BR>I can do a find and replace but the problem is that not all the pages are in the same place...Is there a simple way of changing the links to relative while maintaining a valid link?<BR><BR>E.g. current link is <a href="File:///C:/My Documents/mylinkedpage.html>click here<end tag>

    The link it should be is: <a href="""../../../my documents/mylinkedpage.html>click here<end tag>

    I'm guessing that it will have to be a manual process but hopefully someone will prove me wrong and come up with some amazing way of doing it ?

    Cheers
    So far I know when linking from your site to another site, you should always use absolute links.

    If not, then you may use relative links.

  3. #3
    SitePoint Wizard
    Join Date
    Aug 2002
    Location
    N.Ireland
    Posts
    1,046
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It really sounds like a search and replace exercise which you would do at folder level - I assume all pages are on the one server and are just moving to another?

    Alternatively, if you're using ASPs you can declare an application variable which sets the root folder then declare that variable in front of all of your hrefs doing without the need for loads of "../"

    By the way I think this topic needs moved!


Bookmarks

Posting Permissions

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