Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to mirror a site with wget and convert all the links to the local copies I've downloaded. So far that's easy all I have to do is wget -mk

However all of the static media is located in a different domain, if I follow all of the foreign hosts using the -H option it will download that static media files, but it will also download anything else externally linked.

Is there a way to specify 'only download foreign hosts specified in list X'?

share|improve this question

See the section in the wget manpage after the --page-requisites option, it has an example:

Links from that page to external documents will not be followed. Actually, to download a single page and all its requisites (even if they exist on separate websites), and make sure the lot displays properly locally, this author likes to use a few options in addition to -p:

wget -E -H -k -K -p http://<site>/<document>
share|improve this answer
I tried the -p option, but still no luck – mountainswhim Feb 25 '10 at 3:37
should I take that to mean that you tried the -p option but ignored the section I quoted that tells you that you need a few more options and gives you an example? – Justin Feb 25 '10 at 4:41
exactly, I'm already using -k. -K does nothing more but backup files before converting them and -E just renames extensions if needed. As for -H, you can see my problem with that in my initial question. – mountainswhim Feb 25 '10 at 5:08

Add, with your equivalent domains.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.