Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 want to download a website that uses php to generate its pages. If I use

wget --convert-links --mirror --trust-server-names

the php files are downloaded as php files. When I open the webpage locally, FF gives me a popup box asking whether I want to open the php file of a page with gedit.

Is there any way to download a full web page as plain html so that I can access them in a browser locally?

share|improve this question
Did you try using: wget -r :D – Tony Wael Jun 12 '15 at 22:20
up vote 3 down vote accepted

Alternatively, you can force wget to rename every extension to HTML on download with the --adjust-extension/-E flag:

wget --convert-links --mirror --trust-server-names --adjust-extension
share|improve this answer

Httrack is pretty good at downloading entire webpages as static offline-copies.

I've used it a few times with good results.

share|improve this answer
Hi mike, thanks for the suggestion. For some or other reason it did not work out of the box for me and I have no time to check. But it seems promising. – don.joey Oct 11 '13 at 12:27

They're not actually PHP files though, they just have PHP extensions. There's no simple fix for this. You could rename all the files to .html but then all the links would need fixing too.

The simplest way is to serve the files instead of Firefox opening them directly. You can do that by cding into the directory and then using some python magic:

python -m SimpleHTTPServer 8080

And then opening http://localhost:8080 in your browser.

Again, these aren't real PHP, they're just saved in files that mirror the URL. You don't need to set up PHP and/or Apache (et al) to view them.

Edit: if you have PHP installed you can use PHP's built-in server:

 php -S localhost:8080

That should handle the mimetype issue, but I wouldn't bother if you don't have PHP installed.

share|improve this answer
Nice idea, but I think this also simply serves the .php file as a download. – don.joey Oct 11 '13 at 12:28
I can confirm that this does not work. – don.joey Oct 11 '13 at 12:31
Yeah, bloody MIME types. This can be overridden but it's a big fluffy pain in the bottom. – Oli Oct 11 '13 at 12:38
thanks for the update – don.joey Oct 11 '13 at 13:34

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.