如何将动态(PHP)网站存档为静态HTML? [英] How to Archive a Dynamic (PHP) Website as Static HTML?

查看:117
本文介绍了如何将动态(PHP)网站存档为静态HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在关闭会话网络(包括 Internet存档上呈现我们网站的静态HTML版本以进行永久托管.

We're in the process of shutting down The Conversations Network (including the IT Conversations podcast). The plan is to render a static-HTML version of our websites for permanent hosting at the Internet Archive.

从目前通过PHP动态生成的大约5,000个动态页面中生成静态HTML的最简单方法是什么?

What's the easiest way to generate static HTML from the roughly 5,000 dynamic pages currently generated dynamically from PHP?

我知道我们可以调整代码以缓存PHP输出,将其写入文件,然后遍历站点地图以生成每个页面.但是我想知道是否应该考虑任何选择.是否有任何工具可以执行此操作并按原样抓取HTML? (除了Acrobat Pro以外的其他东西?)

I know we could tweak the code to cache the PHP output, write it to files, then walk the sitemaps to generate every page. But I wonder if there are any options we should consider. Any tools for doing this and scraping the HTML as-is? (Something other than Acrobat Pro?)

不幸的是,我们也有大量的Ajax调用,这将使此操作变得更加困难.我想我们必须先取消对它们的Ajax处理.

Unfortunately, we also have a fair number of Ajax calls, which are going to make this more difficult. I imagine we'll have to un-Ajax them first.

推荐答案

有很多叫做" Teleport Pro "(很遗憾,是付费软件),它可以创建可浏览/重复的网站副本.将其上传到服务器后,其工作原理应与原始网站完全相同.

There is a great piece of software called "Teleport Pro" (payware unfortunately), and it can create browsable/duplicated copies of a website. Which, once uploaded to a server, should work exactly the same as the original site.

从动态页面创建静态html时要记住的事情;

Things to keep in mind though when your creating static html from dynamic pages are;

  • 您当前的ajax调用需要取消ajax(如您自己说的那样)
  • .htaccess设置,例如mod_rewrite可以使您的静态文件一文不值.因为链接可能不起作用.

但是"Teleport pro"是一个真正可靠的程序,已经存在了相当长的时间.我过去曾经使用过它,并且可能会再次使用它.

But "Teleport pro" is a real solid program which is around for quite some time. I have used it in the past and will probably use it again.

另一种方法可能是创建缓存的php模块"php-apc".在这种情况下,您将需要在创建完整的缓存之前对整个站点进行爬网.我不太熟悉它,但是安装很容易完成,因此您可以查看生成的文件是否有用.

Another approach might be the php module "php-apc" which creates a cache. In this case u would need to crawl the whole site, before a complete cache is created. Im not TOO familiar with it, but an install is easily done, and you could see if the generated files are of any use.

这篇关于如何将动态(PHP)网站存档为静态HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆