Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Solve the problem of static Wordpress pages and non-generation of static files

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Solve the problem that Wordpress pages are static and static files are not generated? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Page static problem

We first need to download the cos-html-cache 2.7.3 page static plug-in

1. Search for the cos-html-cache plug-in in the install plug-in page, and install

2. Create a html folder under the root directory with permission of 777

3. Create an index.bak file in the root directory with permission 666

4. Modify the fixed connection format to a custom structure, / html/%post_id%_%postname%.html

5. Activate the plug-in

6. Modify the default home page order of the site by adding a line in .htaccess:

DirectoryIndex index.html index.htm index.php index.cgi

7. Modify the topic search box code. In the searchform.php file, the code will be as follows:

Action= ""

To be replaced by:

Action= ""

Verify, log out, revisit the page, generate the html file in the html directory, and contain a string in the page source code to successfully install.

The problem that static files cannot be generated

Because the DOCUMENT_ROOT defined by some servers is inconsistent with the directory path of the virtual space, cos-html-cahce cannot find the correct directory to generate html. For example, the server of 000webhost is like this.

There is one line in the cos-html-cache.php file:

$path = $_ SERVER ['DOCUMENT_ROOT']. "/"

The solution can be to use a php script to test the space path of your host, and then change the value of $path to the space root path. You can create a php file and write the following code.

Then upload to the root directory of the space, access the script file, compare and view the path of DOCUMENT_ROOT and space, and change the value of $path if it is inconsistent. For example, the result returned by http://localhost/root_test.php, is as follows:

SeverPath: / home/a4675762/public_htmlDOCUMENT_ROOT: / usr/local/apache/htdocs/

You can see that the two paths are completely different, so change $path to:

$path = "/ home/a4675762/public_html/"

Log out of the blog (you must log out to generate a html static page), then revisit the page, and the html should be generated normally.

Thank you for reading! After reading the above, do you have a general understanding of solving the problem of static Wordpress pages and non-generation of static files? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report