Absolute link corrections

9 views
Skip to first unread message

Catherine Sentz

unread,
Jan 14, 2024, 1:01:38 PMJan 14
to RootsWeb-Website-Help
I inherited an RW site that has been recently moved to another server.  The original RW site has the new URL on the main page with a link to the new site.  In the process of updating pages on the new site, I have discovered that the person that created the original site  used some absolute links to pages within the site rather than relevant links. So, as a result, some links go back to the original RW page.  (Hope you are following what I am describing). Does anyone know of a program that can correct or convert the absolute links to relevant links without doing this manually?  Please note again, this is for links back and forth within in the site. 

Barry Carlson

unread,
Jan 14, 2024, 3:14:04 PMJan 14
to rw-webs...@googlegroups.com

Catherine,

Firstly, apologies to all the RW-Website-Help email recipients who recently received a misdirected email from me via the group on matters completely unrelated to HTML. How it happened is not known, other than my Thunderbird email client did an update at the same time.

--------------

Your question regarding automatically converting website internally generated 'absolute' links to 'relative' links, is a subject that is littered with 'fish-hooks'.  Firstly, the version of HTML used and the validity of the code on each page changed comes into play. Secondly, any associated CSS is assumed not to have changed an inline element such as <b> tag into a block level element which is now being used for something unrelated to 'font-weight:bold'.  These things happen, and I deliberately do similar things for various reasons; knowing that a browser will render the code as it is told to do. 

There is a Perl language program that supposedly will do what you want -

http://www.perlmonks.org/?node_id=56338

Like any program, it only does what it is told to do, and if one of those 'fish-hooks' gets in the way, the page will likely get mangled. 

I have not used it / tried it, and suspect that you may have no other option than to go to each directory and create a relative link that can be used in a Search and Replace manner, to find the 'absolute' path prior to the filename and replace it with a 'relative' path to the filename. The text-editor I use is - Notepad++ and it provides a Search and Replace function which can be used to automatically chase down the Search term in all the pages in a directory and Replace it with the nominated term.

Barry

On 15/01/2024 7:01 am, Catherine Sentz wrote:
I inherited an RW site that has been recently moved to another server.  The original RW site has the new URL on the main page with a link to the new site.  In the process of updating pages on the new site, I have discovered that the person that created the original site  used some absolute links to pages within the site rather than relevant links. So, as a result, some links go back to the original RW page.  (Hope you are following what I am describing). Does anyone know of a program that can correct or convert the absolute links to relevant links without doing this manually?  Please note again, this is for links back and forth within in the site.  --


Virus-free.www.avg.com

Pat Asher

unread,
Jan 14, 2024, 3:44:27 PMJan 14
to rw-webs...@googlegroups.com
Catherine, I use NoteTab Light for search and replace and Pat Geary has published the instructions for using it at https://sites.rootsweb.com/~gearyfamily/search-and-replace-notetab-light.html

You can use the search and replace function in any program to find for example:
a href="https://sites.rootsweb.com/~accountname/filename.html"
and replace it with
a href="filename.html or
a href="directoryname/filename.html" or even
a href="../filename.html
as appropriate for the directory level of the file containing the absolute link.

Just watch for the "hooks" Barry mentioned.

Pat Asher

Charlie Carothers

unread,
Jan 14, 2024, 3:59:02 PMJan 14
to rw-webs...@googlegroups.com
Barry, no problem on the misdirected email!

I'm glad to hear you say that Notepad++ will find and change all the paths in the files in a directory. I use that editor quite a bit, and I'd seen somewhere that it would do that, but never having tried it I was a bit leery. I'm afraid I may be faced with that due to converting a website from http to https one of these days. I unfortunately have many thousands of absolute links that start with http://www. And no, I didn't do that; it came with a 23 year old website I began maintaining about 7 years ago. :-) The former webmaster believed that absolute links improved your SEO rating. Perhaps it did at one time, but as I think the SEO criteria change about every couple of weeks, I seriously doubt that is true today.

Blessings,
--
Reply all
Reply to author
Forward
0 new messages