WordPress Export Full Static Website - Moonlight Blog
Moonlight Blog » Website construction » WordPress export full static website

WordPress export full static website

WordPress As a popular blog website building software in the world, Wordpress is very mature both in terms of interface and function. However, it is a pity that Wordpress mainly builds dynamic website pages, which consumes a lot of performance. Building a large website with Wordpress takes up more resources on the server side. In many cases, we need a completely static website.

A completely static website has only html files, which consumes very little server resources. Many places provide free hosting services for static websites, so the running cost of static websites is very low. In addition, static websites are very secure, and there are almost no exploitable vulnerabilities. Compared with dynamic websites, you don't need to worry about security issues too much. In terms of access, the number of real-time visits is very large, Static websites can also be well supported, basically without any performance problems.

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

 Static website

In Wordpress's "Settings" - "Fixed Connection", set the fixed link to "Custom Structure", and add. html at the end of the title of the article. In this way, the article page will be displayed as a static page, but the directory and tags will still be dynamic pages.

After that, turn off the comment function of Wordpress. In Settings - Discussion, select "Automatically turn off the comment function on articles published one day later".

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

However, if the number of articles is more than 5000, such as tens of thousands of articles, an error will usually be reported when using the Simple Static plug-in to generate html, because the general website server will set timeout and memory limits on php. Our common solution is to set up a local php environment and modify the timeout and memory size of php, for example, for Windows For the system, you can choose to install a software called "Pagoda Panel" to quickly configure a WAMP environment. After installation, you can modify the php timeout and memory size in the environment. At this time, using the Simple Static plug-in will not report errors.

Even so, for those with more than 10000 articles WordPress For example, the simple static plug-in is too slow to generate websites for almost several hours. Here we recommend another static plug-in: the WP2Static plug-in.

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 used the WP2Static plug-in, I also found some problems, which were successfully generated through multiple debugging.

1. The home page directory is missing, and only a few home pages are generated, while other pages are not. My solution is to install a plug-in named WP PageNavi, and set the number of "how many pages to display" in the plug-in as the maximum number of pages, so that all home 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", so that the website can be generated to a local directory. Then, in the Crawling option, all three options in the Detection level are ignored, In this way, all content pages and article pages can be generated.

After these processing, we get a completely static website's html file 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 codes of WordPress, can support large traffic access, and basically has no security risks and vulnerabilities, except for the trouble of updating, Other aspects are almost the same as the original WordPress, which is a good way to deploy websites with low cost and high quality.

 WordPress export full static website

Top ▲ ( )   Press ▼ ( )

Related articles

Post a message