WordPress knowledge sharing

How to set pseudo static state for ZBLOG PHP secondary directory station

Today, I met a netizen @ Cherry, who wants to add a subsite in Zblog php (the main site), point to the directory under the main site, and access it with a secondary domain name, and both sites need to implement pseudo static. Wei Aisi's notes have never been involved in such projects. It took a little time to implement them, and we quickly shared them, hoping to help everyone.

Installation environment requirements PHP 7.3~7.4 and MySQL 5.5~5.6 are recommended;
Pseudo static (fixed link), using Pagoda panel one key setting pseudo static Linux system is recommended for better use experience;
For the sake of website security, stability and speed, Lao Wei recommends choosing Pagoda panel Build a website environment AliCloud server Tencent ECS Deployment theme;
The entry-level host is configured with 1 core 2G memory and 1 M bandwidth. Lao Wei suggested selecting 2 core 4G memory and 1 M bandwidth;
The theme can only be activated when it is accessible through the internet, and the local/intranet server may not be able to activate the authorization;

1. Purpose to be achieved

Primary site domain name example.com
Sub site root directory/baike folder under the primary site root directory
Website access url: example.com/baike
Site programs: Zblog php
Both sites implement pseudo static

2. Generate pseudo static rules for sub site Zblog

The main site can use the nginx pseudo static rules that come with the pagoda panel, while the sub sites need to add them manually.

Go to the static management center in the background of the zblog of the subsite, configure the page, select the current web service, and then generate the corresponding pseudo static rules.

Finally, copy it for use.

 Go to the static management center in the background of the zblog of the sub site, configure the page, select the current web service, and then generate the corresponding pseudo static rules

3. Pseudo static rules for merging primary and secondary stations

At this time, enter the website in the background of the pagoda panel, click the domain name of the main site to enter Site Modification>Pseudo Static, and see the system's default zblog pseudo static rules.

At this point, we use the following rule to override the default rule, which is the new master pseudo static rule.

 location / { if (-f $request_filename/index. HTML){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!- f $request_filename){ rewrite (.*) /index.php; } }

Add a new baike subdirectory below for the use of subsites. The pseudo static rule is to paste the rule generated by the second subsite above here.

 location /baike/ { if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!- f $request_filename){ rewrite (.*) /baike/index.php; } }
 Pseudo static rule of ZBLOG PHP secondary directory station merging master station and sub station

Tip: From the above pseudo static rules, we can see that compared with the pagoda default zblog pseudo static rules, the new master site rules only have one location/{} containing statement at both ends. There is no complicated content, and beginners should not find it difficult.

4. Concluding work

You must restart Nginx (or IIS or Apache) to take effect. Check whether the master station and sub station have achieved pseudo static. If there is no problem, the setting is successful. Let the ZBLOG PHP master station and sub station achieve pseudo static.

Like( zero )
Article name: How to set pseudo static state for ZBLOG PHP secondary directory station
Article link: https://www.vpsss.net/27700.html
Copyright notice: The resources of this website are only for personal learning and exchange, and are not allowed to be reproduced and used for commercial purposes, otherwise, legal issues will be borne by yourself.
The copyright of the pictures belongs to their respective creators, and the picture watermark is for the purpose of preventing unscrupulous people from stealing the fruits of labor.