🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

z-blog subdirectory pseudo-static rule setting method

After building a website using Z-Blog,how do you set up the server'spseudo-static rules? Actually, the official Zblog provides pseudo-static rules for common web environments like Apache + .htaccess, IIS 7 and above + URL Rewrite Module, IIS 6 + ISAPI Rewrite 2.X, Nginx, and Lighttpd on the pseudo-static settings page. If you still don't know how, just read this article.

Zblog pseudo-static rule acquisition

1. After logging into the ZBLOG backend, click on Plugin Management and find the Static Management Center. If you don't have the Static Management Center, go to the App Center and install one yourself.zblog伪静态规则2. In the settings interface, select Pseudo-Static, then you can modify the rules below or keep the defaults.zblog伪静态规则3. After clicking OK, you will be redirected to the ReWrite Rules interface.zblog伪静态规则4. Add the generated pseudo-static rules to your website's pseudo-static configuration.

Zblog Pseudo-Static Rules for Different Programs

Apache Zblog Pseudo-Static Rules

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /zixun/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /zixun/index.php [L]
</IfModule>
Save the above content as a.htaccessfile, then upload it to the website root directory. The same applies to subdirectory rules.

IIS7 Zblog Pseudo-Static Rules

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
  <rewrite>
   <rules>
	<rule name="/zixun/ Z-BlogPHP Imported Rule" stopProcessing="true">
	 <match url="^.*?" ignoreCase="false" />
	  <conditions logicalGrouping="MatchAll">
	   <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
	   <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
	  </conditions>
	 <action type="Rewrite" url="index.php/{R:0}" />
	</rule>
	<rule name="/zixun/ Z-BlogPHP Imported Rule index.php" stopProcessing="true">
	 <match url="^index.php/.*?" ignoreCase="false" />
	  <conditions logicalGrouping="MatchAll">
	   <add input="{REQUEST_FILENAME}" matchType="IsFile" />
	  </conditions>
	 <action type="Rewrite" url="index.php/{R:0}" />
	</rule>
   </rules>
  </rewrite>
 </system.webServer>
</configuration>
Create a web.config file in the website"s "current directory" and copy the relevant content into it. The same applies to subdirectories.

IIS6 Zblog Pseudo-Static Rules

[ISAPI_Rewrite]

RewriteRule /zixun/page_([0-9]*)\.html /zixun/index\.php\?page=$1&rewrite=1&full_uri=$0 [I,L]
RewriteRule /zixun/date-([0-9\-]+)(?:_)?([0-9]*)\.html /zixun/index\.php\?date=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /zixun/author-([0-9]+)(?:_)?([0-9]*)\.html /zixun/index\.php\?auth=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /zixun/tags-([0-9]+)(?:_)?([0-9]*)\.html /zixun/index\.php\?tags=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /zixun/category-([0-9]+)(?:_)?([0-9]*)\.html /zixun/index\.php\?cate=$1&page=$2&rewrite=1&full_uri=$0 [I,L]
RewriteRule /zixun/post-([0-9]+)\.html(\?.*)? /zixun/index\.php\?id=$1&rewrite=1&full_uri=$0 [I,L]
RewriteRule /zixun/([0-9]+)\.html(\?.*)? /zixun/index\.php\?id=$1&rewrite=1&full_uri=$0 [I,L]
Please create an httpd.ini file in the website root directory and copy the relevant content into it. The httpd.ini file must be in ANSI encoding. You can also click the button to generate it. Note: Users of this rule can add custom rules to exclude their own directories or files from overly broad rewriting. Note: For ISAPI Rewrite 3, please generate rules according to the Apache rules.

Nginx Zblog Pseudo-Static Rules

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 (.*) /zixun/index.php;
}
Modify nginx.conf, add the above rules between the location / { } node or the location [installation directory name] / { } node (for subdirectory installation). To explain, if youinstall Zblog in a subdirectory, then the correspondingpseudo-static ruleslooks like this:
location /zblog/ {
	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 (.*) /zixun/index.php;
}

}
If you are using the LNMP one-click package, you can save the above subdirectory pseudo-static rules as a separate conf file. For example, zblog2.conf, and then include it in the virtual host configuration file.include rewrite/zblog2.conf;For Baota Panel, add the subdirectory rules after the current pseudo-static rules.

Z-Blog Pseudo-Static Style Customization

If you are not satisfied with the default Z-blog pseudo-static link effect, you can DIY it yourself. The corresponding parameters are as follows:1. Article URL ConfigurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%id%}: Article ID, either Article ID or Article Alias must be selected
  • {%alias%}: Article Alias, either Article ID or Article Alias must be selected
  • {%year%}: Article year, optional
  • {%month%}: Article month, optional
  • {%category%}: Article category slug, optional
2. Page URL configurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%id%}: Page ID, must choose either Page ID or Page slug
  • {%alias%}: Page slug, must choose either Page ID or Page slug
3. Homepage URL configurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%page%}: Pagination number, required
4. Category page URL configurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%id%}: Category ID, use at least one of Category ID or Category slug
  • {%alias%}: Category slug, use at least one of Category ID or Category slug
  • {%page%}: Pagination number, required
5. Tag page URL configurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%id%}: Tag ID, choose at least one of Tag ID or Tag slug
  • {%alias%}: Tag slug, choose at least one of Tag ID or Tag slug
  • {%page%}: Pagination number, required
6. Date archive page URL configurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%date%}: Date, required
  • {%page%}: Pagination number, required
7. Author page URL configurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%id%}: Author ID, required
  • {%page%}: Pagination number, required
 

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step.

「Naibabiji WordPress Website Building Coaching Service」—From choosing a domain and buying hosting, to installing a Theme and publishing content, I「ll coach you through every step, helping you avoid detours and reach your goal directly.

👉 Learn about the Website Building Coaching Service
🔒

Comments are closed

The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.

×
二维码

Scan QR Code to Follow

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: