Discuz! X3.1 pseudo-static rules in Apache, IIS, and other server environments

Source: Internet
Author: User
One of the biggest features of the Discuz forum is that it can well support pseudo-static resources for SEO optimization. We all know that pseudo-static rules need to be defined. different servers use different pseudo-static function plug-ins, and the rule definition methods are slightly different, many of my friends search for the pseudo-static rules of discuzx3.1 on the Internet,

One of the biggest features of the Discuz forum is that it can well support pseudo-static resources for SEO optimization.

We all know that pseudo-static rules need to be defined. different servers use different pseudo-static function plug-ins, and the rule definition methods are slightly different. many of our friends are still searching for them on the Internet.DiscuzWhat are the pseudo-static rules of x3.1? in fact, this is not necessary. The new versionDiscuzThere is a special page in the background to illustrate the pseudo-static definition methods for different servers.

Log on to the discuz forum management center with the administrator account.
Global>SeoSet-> static url
There is a link in the upper-right corner of the page.

View the static URL of the current Rewrite rule

Click this link to see the pseudo-static setting rules for discuz X3.1 in various browsers.

Apache Web Server (Independent host user)


RewriteEngine On
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/topic-(. +) \. html $1/portal. php? Mod = topic & topic = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/article-([0-9] +)-([0-9] +) \. html $1/portal. php? Mod = view & aid = $2 & page = $3 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/forum-(\ w +)-([0-9] +) \. html $1/forum. php? Mod = forumdisplay & fid = $2 & page = $3 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/thread-([0-9] +)-([0-9] +)-([0-9] + )\. html $1/forum. php? Mod = viewthread & tid = $2 & extra = page \ % 3D $4 & page = $3 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/group-([0-9] +)-([0-9] +) \. html $1/forum. php? Mod = group & fid = $2 & page = $3 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/space-(username | uid)-(. +) \. html $1/home. php? Mod = space & $2 = $3 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/blog-([0-9] +)-([0-9] +) \. html $1/home. php? Mod = space & uid = $2 & do = blog & id = $3 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/(fid | tid)-([0-9] +) \. html $1/index. php? Action = $2 & value = $3 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ (. *)/([a-z] + [a-z0-9 _] *)-([a-z0-9 _ \-] + )\. html $1/plugin. php? Id = $2: $3 & % 1


Apache Web Server (virtual host user)

# Enable RewriteEngine mode
RewriteEngine On

# Modify/discuz in the following statement to the address of your Forum directory. if the program is placed in the root directory, change/discuz/
RewriteBase/discuz

# Do not modify Rewrite system rules
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ topic-(. +) \. html $ portal. php? Mod = topic & topic = $1 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ article-([0-9] +)-([0-9] +) \. html $ portal. php? Mod = view & aid = $1 & page = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ forum-(\ w +)-([0-9] +) \. html $ forum. php? Mod = forumdisplay & fid = $1 & page = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ thread-([0-9] +)-([0-9] +)-([0-9] +) \. html $ forum. php? Mod = viewthread & tid = $1 & extra = page \ % 3D $3 & page = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ group-([0-9] +)-([0-9] +) \. html $ forum. php? Mod = group & fid = $1 & page = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ space-(username | uid)-(. +) \. html $ home. php? Mod = space & $1 = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ blog-([0-9] +)-([0-9] +) \. html $ home. php? Mod = space & uid = $1 & do = blog & id = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ archiver/(fid | tid)-([0-9] +) \. html $ archiver/index. php? Action = $1 & value = $2 & % 1
RewriteCond % {QUERY_STRING} ^ (. *) $
RewriteRule ^ ([a-z] + [a-z0-9 _] *)-([a-z0-9 _ \-] +) \. html $ plugin. php? Id = $1: $2 & % 1

IIS Web Server (Independent host user)

[ISAPI_Rewrite]

#3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd. ini and httpd. parse. errors files
# From accessing through HTTP
RewriteRule ^ (. *)/topic-(. +) \. html (\? (. *) * $1/portal \. php \? Mod = topic & topic = $2 & $4
RewriteRule ^ (. *)/article-([0-9] +)-([0-9] +) \. html (\? (. *) * $1/portal \. php \? Mod = view & aid = $2 & page = $3 & $5
RewriteRule ^ (. *)/forum-(\ w +)-([0-9] +) \. html (\? (. *) * $1/forum \. php \? Mod = forumdisplay & fid = $2 & page = $3 & $5
RewriteRule ^ (. *)/thread-([0-9] +)-([0-9] +)-([0-9] + )\. html (\? (. *) * $1/forum \. php \? Mod = viewthread & tid = $2 & extra = page \ % 3D $4 & page = $3 & $6
RewriteRule ^ (. *)/group-([0-9] +)-([0-9] +) \. html (\? (. *) * $1/forum \. php \? Mod = group & fid = $2 & page = $3 & $5
RewriteRule ^ (. *)/space-(username | uid)-(. +) \. html (\? (. *) * $1/home \. php \? Mod = space & $2 = $3 & $5
RewriteRule ^ (. *)/blog-([0-9] +)-([0-9] +) \. html (\? (. *) * $1/home \. php \? Mod = space & uid = $2 & do = blog & id = $3 & $5
RewriteRule ^ (. *)/(fid | tid)-([0-9] +) \. html (\? (. *) * $1/index \. php \? Action = $2 & value = $3 & $5
RewriteRule ^ (. *)/([a-z] + [a-z0-9 _] *)-([a-z0-9 _ \-] +) \. html (\? (. *) * $1/plugin \. php \? Id = $2: $3 & $5

IIS7 Web Server (Independent host user)








































Zeus Web Server

Match URL into $ with ^ (. *)/topic-(. +) \. html \? * (. *) $
If matched then
Set URL = $1/portal. php? Mod = topic & topic = $2 & $3
Endif
Match URL into $ with ^ (. *)/article-([0-9] +)-([0-9] +) \. html \? * (. *) $
If matched then
Set URL = $1/portal. php? Mod = view & aid = $2 & page = $3 & $4
Endif
Match URL into $ with ^ (. *)/forum-(\ w +)-([0-9] +) \. html \? * (. *) $
If matched then
Set URL = $1/forum. php? Mod = forumdisplay & fid = $2 & page = $3 & $4
Endif
Match URL into $ with ^ (. *)/thread-([0-9] +)-([0-9] +)-([0-9] + )\. html \? * (. *) $
If matched then
Set URL = $1/forum. php? Mod = viewthread & tid = $2 & extra = page \ % 3D $4 & page = $3 & $5
Endif
Match URL into $ with ^ (. *)/group-([0-9] +)-([0-9] +) \. html \? * (. *) $
If matched then
Set URL = $1/forum. php? Mod = group & fid = $2 & page = $3 & $4
Endif
Match URL into $ with ^ (. *)/space-(username | uid)-(. +) \. html \? * (. *) $
If matched then
Set URL = $1/home. php? Mod = space & $2 = $3 & $4
Endif
Match URL into $ with ^ (. *)/blog-([0-9] +)-([0-9] +) \. html \? * (. *) $
If matched then
Set URL = $1/home. php? Mod = space & uid = $2 & do = blog & id = $3 & $4
Endif
Match URL into $ with ^ (. *)/(fid | tid)-([0-9] +) \. html \? * (. *) $
If matched then
Set URL = $1/index. php? Action = $2 & value = $3 & $4
Endif
Match URL into $ with ^ (. *)/([a-z] + [a-z0-9 _] *)-([a-z0-9 _ \-] +) \. html \? * (. *) $
If matched then
Set URL = $1/plugin. php? Id = $2: $3 & $4
Endif

Nginx Web Server

Rewrite ^ ([^ \.] *)/topic-(. +) \. html $1/portal. php? Mod = topic & topic = $2 last;
Rewrite ^ ([^ \.] *)/article-([0-9] +)-([0-9] + )\. html $1/portal. php? Mod = view & aid = $2 & page = $3 last;
Rewrite ^ ([^ \.] *)/forum-(\ w +)-([0-9] +) \. html $1/forum. php? Mod = forumdisplay & fid = $2 & page = $3 last;
Rewrite ^ ([^ \.] *)/thread-([0-9] +)-([0-9] +)-([0-9] + )\. html $1/forum. php? Mod = viewthread & tid = $2 & extra = page % 3D $4 & page = $3 last;
Rewrite ^ ([^ \.] *)/group-([0-9] +)-([0-9] + )\. html $1/forum. php? Mod = group & fid = $2 & page = $3 last;
Rewrite ^ ([^ \.] *)/space-(username | uid)-(. +) \. html $1/home. php? Mod = space & $2 = $3 last;
Rewrite ^ ([^ \.] *)/blog-([0-9] +)-([0-9] + )\. html $1/home. php? Mod = space & uid = $2 & do = blog & id = $3 last;
Rewrite ^ ([^ \.] *)/(fid | tid)-([0-9] +) \. html $1/index. php? Action = $2 & value = $3 last;
Rewrite ^ ([^ \.] *)/([a-z] + [a-z0-9 _] *)-([a-z0-9 _ \-] + )\. html $1/plugin. php? Id = $2: $3 last;
If (! -E $ request_filename ){
Return 404;
}

The discuz forum is becoming more and more user-friendly and more complete.

Note that if you are using an iis server, the above IIS Independent host rules also apply to the IIS virtual host, because they are generally using the isapi_rewrite plug-in.

The only thing to note is the isapi_rewrite version. the isapi_rewrite2.x version can use the above rules. if it is isapi_rewrite3.x, rewrite the rules under apache. otherwise, your discuz Forum still cannot be accessed using pseudo-static links.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.