WordPress export full static web site

Reprint Moonlight Blog  2019-01-20 18:57:46 Read 399 times Comment 0

Wordpress as the world's popular blog site software, whether from the interface or function is very mature, but there is a little regret, Wordpress is mainly established dynamic web page, its performance consumption is relatively large, with Wordpress to build a larger website, server side resources occupy more, and many times, we need is a completely static website. Completely static web sites only have HTML files, which consume very low server resources. Many places provide free hosting static web services, so static website running costs are very low. In addition, the static web security is very good, and there are almost no vulnerabilities to attack. Compared to dynamic web sites, there is no need to worry too much about security issues.

Wordpress is popular in the world. Blog Station building Software No matter it is from interface or function, it is very mature. But unfortunately, Wordpress is mainly built on dynamic web pages. Its performance consumption is relatively large. Using Wordpress to build larger web sites takes up more resources for server side resources. Many times, we need a completely static web site.

Completely static web sites only have HTML files, consume very low server resources, and provide free hosting static website services in many places. Therefore, the static website running cost is very low. In addition, the static web site is very expensive. security Sex is good, there is almost no vulnerability to attack. Compared to dynamic web sites, there is no need to worry too much about security issues. In terms of access, instant access is very large, static websites can also be well supported, and basically there will be no performance problems.

So, how can a Wordpress website be completely static? Next I will talk about the method.

WordPress导出全静态化网站.jpg WordPress导出全静态化网站 业界动态

In Wordpress's "Settings" - "fixed connection", the fixed link is set to "custom structure". The title of the article is added.Html at the end, so that the article page is displayed as static page, but the directory and label are still dynamic pages.

After that, close the comment function of Wordpress. In the "Settings" - "discussion", choose the "comment function on the article automatically closed for 1 days".

If the number of articles in Wordpress is less than 1000, you can install a plug-in called Simply Static, which can generate static web sites in a short time and provide downloads. This is very simple.

However, if the number of articles is larger than 5000 articles, such as tens of thousands of articles, then, when using Simply Static plug-in to generate HTML, it will usually be wrong, because the general web server will set up timeout and memory limits on PHP. Our usual solution is to build a PHP environment locally, modify PHP timeout time and memory size, such as Windows. system For example, you can choose to install a software called "pagoda panel", quickly configure a WAMP environment, install it, modify the PHP timeout time and memory size in the environment, and use the Simply Static plug-in at this time will not be wrong.

In the meantime, for WordPress with over 10000 articles, Simply Static plug-ins are slow to generate web sites for almost a few hours. Here we recommend another static plug-in: WP2Static plug-in.

In the WP2Static plug-in, modifying the number of Crawl Increment to more than 100 can effectively improve the speed of page generation. However, when I was using WP2Static plug-in, I also found some problems, and I succeeded through many debugging.

1, the home page pagination directory is missing. The page on the front page only generates a few. Other pagination is not generated. My solution is to install a plug-in called WP-PageNavi and set the maximum number of pages to display in the plugin, so that the first page pagination can be generated.

2, directory page missing, directory page only generated a page, my solution is, in "Deploy static website", select "Subdirectory on current server", so that you can generate the site to a local directory, then Crawling option, the Detection level in three options run side, so that you can generate all the directory page and article page.

After these processes, we get a completely static HTML file in the final directory. Then we publish these HTML files to the target website to get a completely static website. This static website does not need WordPress's other PHP code, can support large traffic accesses, basically has no hidden dangers and vulnerabilities. In addition to updating troubles, other aspects are almost the same as the original WordPress. It is a good way to deploy websites with low cost and high quality.

This address: Https://wanbk.net/173.html
Reminder: The content of the article is the author's personal view, which does not mean that the moonlight pub agrees or supports the viewpoint.
Copyright notice: This article is a reprinted article. Moonlight Blog The copyright is owned by the original author. Welcome to share this article. Please keep the source.



I haven't left a message yet. Do you want to grab the sofa quickly?