Current location: home page > Industry trends >Text content

WordPress export static website

Dazzle Yi Two years ago (2019-01-20) Industry trends six hundred and eighteen

WordPress is popular in the world Blog Station building Software It is very mature both in terms of interface and function. However, it is a little pity that WordPress mainly builds dynamic website pages, which consumes a lot of performance. Building a larger website with WordPress takes up more resources on the server side. In many cases, what we need is a completely static website.

A completely static website only has HTML files, which consumes very low server resources. Many places provide free hosting services for static websites. Therefore, the running cost of static websites is very low. In addition, static websites have low cost security Compared with dynamic websites, you don't have to worry too much about security issues. In terms of access, instant visits are very large, and static websites can be well supported. Basically, there will be no performance problems.

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

 WordPress export static website.jpg WordPress export static website industry trends

In WordPress's "Settings" - "fixed connection", set the fixed link to "custom structure", and add. HTML to the end of the title of the article. In this way, the article page will be displayed like a static page, but the contents and labels are still dynamic pages.

After that, turn off the comment function of WordPress, and in settings - discussion, select "automatically turn off the comment function on articles one day after publishing".

If the number of articles in WordPress is less than 1000, you can install a plug-in named simply static, which can generate a static website in a short time and provide download. This is very simple, needless to say.

However, if the number of articles is more than 5000, such as tens of thousands of articles, when using the simply static plug-in to generate HTML, an error will usually be reported, because the general web server will set a timeout and memory limit on PHP. Our usual solution is to build a PHP environment locally and modify the PHP timeout time and memory size, for example, for windows system For example, you can choose to install a software named "pagoda panel" to quickly configure a Wamp environment. After installation, you can modify the PHP timeout time and memory size in the environment. At this time, you can use the simply static plug-in to avoid errors.

For a few static plug-ins, it is better to use static plug-ins for several hours.

In the wp2static plug-in, modifying the number of crawl increments to more than 100 can effectively improve the speed of page generation. However, when I use the wp2static plug-in, I also found some problems, which were successfully generated after several debugging.

1. The first page page page directory is missing. Only a few pages are generated on the first page, but other pages are not generated. My solution is to install a plug-in named WP pagenavi, and set the number of "displayed number of pages" as the maximum number of pages in the plug-in, so that all the first page pages can be generated.

2. The directory page is missing, and only one page is generated. My solution is to select "subdirectory on current server" in the "deploy static website". In this way, the website can be generated to a local directory. After that, in the crawling option, detect is added All three options in level run aside so that all the table of contents and article pages can be generated.

After these processing, we get a completely static HTML file of the website in the final directory, and then we publish these HTML files to the target website to get a completely static website. This static website does not need other PHP code of WordPress, and can support large traffic access. There are basically no security risks and vulnerabilities except for the trouble of updating In addition to the high quality of WordPress, it's almost as good as the other ways.



Welcome to participate in the discussion. Please express your views and exchange your views here.
Call for istwar