RSSAmplifier

Vít Baisa · Apr 1, 2024

How to fix relative links in site downloaded by wget

0
Sign in to vote or save

Vít Baisa · vit.baisa.cz

Wget might have troubles with turning some absolute paths into relative paths when downloading a whole website. I am using GNU Wget 1.21.2 and after running this command to download a site:

the links which were absolute stay absolute so the website is not fully working offline.

You can replace all absolute links (URLs) easily since you know the prefix https://url-of-a-website. The script just needs to keep track of the level of nesting. At the top level it just removes the prefix https://url-of-a-website. At deeper levels it prepends the appropriate number of parent directories ../.

published: 2024-04-01
last modified: 2024-09-15

https://vit.baisa.cz/notes/code/fix-wget-relative-links/

Read the original on vit.baisa.cz

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.