Home  >  Article  >  CMS Tutorial  >  How to make WordPress static

How to make WordPress static

(*-*)浩
(*-*)浩Original
2019-07-13 12:02:405225browse

WordPress is the most popular blogging website building software in the world. It is very mature in terms of interface and function. However, there is one regret. WordPress mainly creates dynamic website pages, which consumes a lot of performance. It is built with WordPress. Larger websites take up more server-side resources, and many times, what we need is a completely static website.

How to make WordPress static

A completely static website only has html files and consumes very little server resources. Many places provide free hosting services for static websites, so the running costs of static websites are very low.

In addition, the security of static websites is very good, and there are almost no vulnerabilities that can be attacked. Compared with dynamic websites, you don’t have to worry too much about security issues. In terms of access, the number of instant visits is very large, and static websites can also be used. It holds up well and basically has no performance issues.

So, how to make a WordPress website completely static? I will talk about the method below.

In WordPress's "Settings" >> "Permalink", set the fixed link to "Custom Structure", add .html to the end of the title of the article, so that the article page is displayed It is the same as a static page, but the directory and tags are still dynamic pages.

After that, turn off the comment function of WordPress. In "Settings" >> "Discussion", select "Automatically turn off the comment function on articles 1 day after publication".

If the number of articles in WordPress is less than 1,000, you can install a plug-in called Simply Static to generate a static website in a short time and provide it for download. This is very simple and needs no further explanation.

However, if the number of articles is greater than 5,000, such as tens of thousands of articles, then when using the Simply Static plug-in to generate HTML, an error will usually be reported, because the general website server will set timeout and memory on PHP limit.

Our usual solution is to build a PHP environment locally and modify the PHP timeout and memory size. For example, for Windows systems, you can choose to install a software called "Pagoda Panel" for quick configuration. A WAMP environment, after it is installed, modify the PHP timeout and memory size in the environment. At this time, using the Simply Static plug-in will not report an error.

Even so, for WordPress with tens of thousands of articles, the Simply Static plug-in is too slow to generate a website, taking almost several hours. Here we recommend using another static plug-in: the WP2Static plug-in.

In the WP2Static plug-in, modifying the number of Crawl Increments to a value above 100 can effectively improve the page generation speed. However, when I used the WP2Static plug-in, I also found some problems and it took multiple debuggings to successfully generate it. .

For more wordpress related technical articles, please visit the wordpress tutorial column to learn!

The above is the detailed content of How to make WordPress static. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn