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

How to Set Up Pseudo-Static Rules for Z-Blog Subdirectories

After building a website using Z-Blog, how do you set up the server'sURL rewrite rules? Actually, the official Z-Blog provides URL rewrite 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 its URL rewrite settings page. If you still don't know how, just read this article.

Zblog pseudo-static rule acquisition

1. After logging into the Z-Blog Admin Dashboard, 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 URL Rewrite, 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 URL rewrite rules to your website's URL rewrite configuration.

Zblog pseudo-static rules for different programs

Apache Zblog pseudo-static rules


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

IIS7 Z-Blog URL Rewrite Rules



 
  
   
	
	 
	  
	   
	   
	  
	 
	
	
	 
	  
	   
	  
	 
	
   
  
 
Create a web.config file in the website"s "current directory" and copy the relevant content into it. The same applies for subdirectories.

IIS6 Z-Blog URL Rewrite 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 ANSI encoded. You can also click the button to generate it. Note: Users can add custom rules to this rule to exclude their own directories or files from overly broad rewriting. Note: For ISAPI Rewrite 3, please generate rules according to Apache rules.

Nginx Z-Blog URL Rewrite 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 Z-Blog in a subdirectory, then the correspondingURL rewrite 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 installation package, you can save the above subdirectory URL rewrite 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 URL rewrite rules.

Z-Blog URL Rewrite Style Customization

If you are not satisfied with the default Z-Blog URL rewrite link format, you can DIY it yourself. The corresponding parameters are as follows:1. Post URL ConfigurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%id%}: Post ID, either Post ID or Post Alias must be selected
  • {%alias%}: Post Alias, either Post ID or Post Alias must be selected
  • {%year%}: Post year, optional
  • {%month%}: Post month, optional
  • {%category%}: Post Category slug, optional
2. Page URL ConfigurationConfigurable parameters:
  • {%host%}: Website address, required
  • {%id%}: Page ID, you must choose either Page ID or Page slug
  • {%alias%}: Page slug, you 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 instead.

「Naibabiji WordPress Website Building Coaching」 — From selecting a domain and purchasing hosting to installing themes and publishing posts, I「ll guide you through every step, helping you avoid detours and reach your goals directly.

👉 Learn about 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 to Follow