4

I have a website - http://myradio1.localhost and the directory is currently empty.

The virtual host works fine, no issues there.

This is my command I'm using to download the site via wget:

wget --user-agent="Googlebot/2.1 (+http://www.googlebot.com/bot.html)" -r --convert-links -p -P "C:\www\public_html\myradio1" "http://www.compassfm.co.uk"

It downloads the site perfectly, except for one thing, it always renders it like this when downloaded:

http://myradio1.localhost/www.compassfm.co.uk

which is not what I want to happen. I want it just to download to the folder, so it can run as http://myradio1.localhost, without me having to move the files out of the domain folder after download has completed.

How can I get wget to download all files, but without creating the domain as a folder, basically?

All help is much appreciated.

avenas8808
  • 155
  • 8

1 Answers1

7

You need the parameter --no-host-directories or -nH, e.g.

wget --user-agent="Googlebot/2.1 (+http://www.googlebot.com/bot.html)" --no-host-directories -r --convert-links -p -P "C:\www\public_html\myradio1" "http://www.compassfm.co.uk"

From the manual:

-nH
--no-host-directories
Disable generation of host-prefixed directories. By default, invoking Wget with -r http://fly.srk.fer.hr/ will create a structure of directories beginning with fly.srk.fer.hr/. This option disables such behavior.

Damir
  • 171
  • 2
  • askubuntu's answer sets a new default (with alias in `.bashrc`) without needing to type the command each time: [how to change wget default directory](https://askubuntu.com/a/213529/1024340) – nilon Apr 15 '20 at 20:06