-1

I have a website located, say, at http://www.abc.com. I need to make it available at, say, http://www.cde.com. I tried to download the site using wget, but encountered two problems:

  • There are many internal absolute links. Wget can convert them to relative links, but I would feel safer if I had them converted to root-relative links insted (ie. /mypath/myfile rather than ../../mypath/myfile) or to absolute links in the new location (http://www.cde.com/mypath/myfile)
  • The site intensively uses scripts for navigation, so some paths look like http://www.abc.com/index.html?p=123, etc. wget downloads and saves them in files like index.html?p=123, index.html?p=456, etc. It is suitable for offline viewing, but I expect that in the new site the scripts would work, so I would only need to have an index.html file (plus requisits, csses, scripts, but I think I already know how to download them)

I know that I can simply delete the spare files with "?" in the file names, but I would prefer to avoid unnecessary downloads in the first place

How can I solve these two issues?

2

I think you can't do what you're trying to do with wget.

The Problem is, that wget sees the Page like it is seen by a Browser. This means wget just gets the HTML Code althought the real Sourcefile may be a PHP File or even a Ruby File or else.

If you are the Owner of the Website you should be able to access the Websites Root Folder either with sftp, ftp or scp and then can copy over the whole page to the new Server.

Now you can use a Editor with a good Refactoring Tool to change all old links to match the new domain name.

1

Using wget to migrate a website is a bad idea unless the source website consist from only static pages with static content, but this is not your case.

In most of cases, the content of pages is generated on server side by template rendering engines (which may be a component of more complicated framework) using predefined templates and data located in some persistent storage like database or hard disk driver o using data submitted by user.

For example, links of form http://www.abc.com/index.html?p=123, http://www.abc.com/index.html?p=456 could indicate that the content of relative pages have been generated on server side from same template (example: index_template.php) and using data from database where product has in one case id 123 and in another case has the id 456.

So, to migrate your site to another position, you should be able to access the source code of your site and all the persistent data. Only then you could make a fully functional clone of original website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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