Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 http://site.com

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

2 Answers 2

Add -Dwww.domain.com,static.domain.com with your equivalent domains.

share|improve this answer

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

Your Answer

 
discard

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.