Detailed explanation of URL Rewrite of pseudo static setting method of destoon

  • 2021-07-02 23:47:30
  • OfStack

1. If your server supports. htaccess, you don't need to set it. htaccess under the root directory of the website has already set the rules.
The rule (refer to http://download.destoon.com/rewrite/htaccess.txt) is:


# Destoon B2B Rewrite Rules
ErrorDocument 404 /404.php
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php
RewriteRule ^(.*)/file/(.*)\.php(.*)$ /404.php
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ $1/show.php?itemid=$2&page=$4
RewriteRule ^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ $1/list.php?catid=$2&page=$4
RewriteRule ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ $1/show.php?itemid=$2&page=$3
RewriteRule ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ $1/list.php?catid=$2&page=$3
RewriteRule ^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$3&page=$4
RewriteRule ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3
RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ index.php?homepage=$2&file=$3&rewrite=$4
RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$ index.php?homepage=$2&file=$3
RewriteRule ^(com)/([a-z0-9_\-]+)([/])?$ index.php?homepage=$2

2. If it is an Apache server:

Users of Apache 1. x should check whether the following two pieces of code exist in conf/httpd. conf:


LoadModule rewrite_module  libexec/mod_rewrite.so
AddModule mod_rewrite.c

Users of Apache 2. x should check for the following 1 code in conf/httpd. conf:


LoadModule rewrite_module  modules/mod_rewrite.so

If it exists and begins with #, delete #. Then add the following code to the configuration file (typically conf/httpd. conf or conf/extra/httpd-vhosts. conf).
At this time, it is important to note that if the website is defined by virtual hosting, it must be added to the virtual hosting configuration, that is, < VirtualHost > If it is added outside the virtual host configuration, it may not be used. After modification, restart Apache.

Apache conf file configuration (refer to http://download.destoon.com/rewrite/apache.txt) rules:


# Destoon B2B Rewrite Rules
ErrorDocument 404 /404.php
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php
RewriteRule ^(.*)/file/(.*)\.php(.*)$ /404.php
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ $1/show.php?itemid=$2&page=$4
RewriteRule ^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ $1/list.php?catid=$2&page=$4
RewriteRule ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ $1/show.php?itemid=$2&page=$3
RewriteRule ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ $1/list.php?catid=$2&page=$3
RewriteRule ^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$3&page=$4
RewriteRule ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3
RewriteRule ^(.*)/com/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ $1/index.php?homepage=$2&file=$3&rewrite=$4
RewriteRule ^(.*)/com/([a-z0-9_\-]+)/([a-z]+)([/])?$ $1/index.php?homepage=$2&file=$3
RewriteRule ^(.*)/com/([a-z0-9_\-]+)([/])?$ $1/index.php?homepage=$2

3. Nginx rules (refer to http://download.destoon.com/rewrite/nginx.txt):


rewrite ^/(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php last;
rewrite ^/(.*)/file/(.*)\.php(.*)$ /404.php last;
rewrite ^/(.*)-htm-(.*)$ /$1.php?$2 last;
rewrite ^/(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ /$1/show.php?itemid=$2&page=$4 last;
rewrite ^/(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ /$1/list.php?catid=$2&page=$4 last;
rewrite ^/(.*)/show/([0-9]+)/([0-9]+)?([/])?$ /$1/show.php?itemid=$2&page=$3 last;
rewrite ^/(.*)/list/([0-9]+)/([0-9]+)?([/])?$ /$1/list.php?catid=$2&page=$3 last;
rewrite ^/(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ /$1/list.php?catid=$3&page=$4 last;
rewrite ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3 last;
rewrite ^/(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ /index.php?homepage=$2&file=$3&rewrite=$4 last;
rewrite ^/(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$ /index.php?homepage=$2&file=$3 last;
rewrite ^/(com)/([a-z0-9_\-]+)([/])?$ /index.php?homepage=$2 last;

4. Zeus rules (refer to http://download.destoon.com/rewrite/zeus.txt):


match URL into $ with ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ 
if matched then 
 set URL = /404.php
endif
match URL into $ with ^(.*)/file/(.*)\.php(.*)$ 
if matched then 
 set URL = /404.php
endif
match URL into $ with ^(.*)-htm-(.*)$ 
if matched then 
 set URL = $1.php?$2 
endif
match URL into $ with ^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ 
if matched then 
 set URL = $1/show.php?itemid=$2&page=$4 
endif
match URL into $ with ^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ 
if matched then 
 set URL = $1/list.php?catid=$2&page=$4 
endif
match URL into $ with ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ 
if matched then 
 set URL = $1/show.php?itemid=$2&page=$3 
endif
match URL into $ with ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ 
if matched then 
 set URL = $1/list.php?catid=$2&page=$3 
endif
match URL into $ with ^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$
if matched then 
 set URL = $1/list.php?catid=$3&page=$4
endif
match URL into $ with ^(.*)/([a-z]+)/(.*)\.shtml$ 
if matched then 
 set URL = $1/$2/index.php?rewrite=$3 
endif
match URL into $ with ^(.*)/com/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ 
if matched then 
 set URL = $1/index.php?homepage=$2&file=$3&rewrite=$4 
endif
match URL into $ with ^(.*)/com/([a-z0-9_\-]+)/([a-z]+)([/])?$ 
if matched then 
 set URL = $1/index.php?homepage=$2&file=$3 
endif
match URL into $ with ^(.*)/com/([a-z0-9_\-]+)([/])?$ 
if matched then 
 set URL = $1/index.php?homepage=$2 
endif

5. IIS6 Server

Please download http://download.destoon.com/rewrite/IIS_Rewrite.zip
The rules have been set. Follow the contents of readme. txt file
If the website supports httpd. ini files, use the following rules (refer to http://download. destoon. com/rewrite/httpd. ini):


[ISAPI_Rewrite]
# Destoon B2B www.destoon.com
# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404\.php
RewriteRule ^(.*)/file/(.*)\.php(.*)$ /404\.php
RewriteRule ^(.*)-htm-(.*)$ $1\.php\?$2
RewriteRule ^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ $1/show\.php\?itemid=$2&page=$4
RewriteRule ^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ $1/list\.php\?catid=$2&page=$4
RewriteRule ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ $1/show\.php\?itemid=$2&page=$3
RewriteRule ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ $1/list\.php\?catid=$2&page=$3
RewriteRule ^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ $1/list\.php\?catid=$3&page=$4
RewriteRule ^(.*)/com/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ $1/index\.php\?homepage=$2&file=$3&rewrite=$4
RewriteRule ^(.*)/com/([a-z0-9_\-]+)/([a-z]+)([/])?$ $1/index\.php\?homepage=$2&file=$3
RewriteRule ^(.*)/com/([a-z0-9_\-]+)([/])?$ $1/index\.php\?homepage=$2
RewriteRule ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index\.php\?rewrite=$3

6. IIS7 Server

The rule (refer to http://download.destoon.com/rewrite/web.config.txt) is:


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
 <system.webServer>
	<rewrite>
   <rules>
    <rule name="destoon_rewrite_0">
      <match url="^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$" />
      <action type="Rewrite" url="/404.php" />
    </rule>
    <rule name="destoon_rewrite_1">
      <match url="^(.*)/file/(.*)\.php(.*)$" />
      <action type="Rewrite" url="/404.php" />
    </rule>
    <rule name="destoon_rewrite_2">
      <match url="^(.*)-htm-(.*)$" />
      <action type="Rewrite" url="{R:1}.php?{R:2}" />
    </rule>
     <rule name="destoon_rewrite_3">
     <match url="^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$" />
     <action type="Rewrite" url="{R:1}/show.php?itemid={R:2}&amp;page={R:4}" />
    </rule>
    <rule name="destoon_rewrite_4">
     <match url="^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$" />
     <action type="Rewrite" url="{R:1}/list.php?catid={R:2}&amp;page={R:4}" />
    </rule>
    <rule name="destoon_rewrite_5">
     <match url="^(.*)/show/([0-9]+)/([0-9]+)?([/])?$" />
     <action type="Rewrite" url="{R:1}/show.php?itemid={R:2}&amp;page={R:3}" />
    </rule>
    <rule name="destoon_rewrite_6">
     <match url="^(.*)/list/([0-9]+)/([0-9]+)?([/])?$" />
     <action type="Rewrite" url="{R:1}/list.php?catid={R:2}&amp;page={R:3}" />
    </rule>
    <rule name="destoon_rewrite_7">
     <match url="^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$" />
     <action type="Rewrite" url="{R:1}/list.php?catid={R:3}&amp;page={R:4}" />
    </rule>
    <rule name="destoon_rewrite_8">
     <match url="^(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$" />
     <action type="Rewrite" url="index.php?homepage={R:2}&amp;file={R:3}&amp;rewrite={R:4}" />
    </rule>
    <rule name="destoon_rewrite_9">
     <match url="^(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$" />
     <action type="Rewrite" url="index.php?homepage={R:2}&amp;file={R:3}" />
    </rule>
    <rule name="destoon_rewrite_10">
     <match url="^(com)/([a-z0-9_\-]+)([/])?$" />
     <action type="Rewrite" url="index.php?homepage={R:2}" />
    </rule>
    <rule name="destoon_rewrite_11">
      <match url="^([a-z]+)/(.*)\.shtml$" />
      <action type="Rewrite" url="{R:1}/index.php?rewrite={R:2}" />
    </rule>
   </rules>
  </rewrite>		
 </system.webServer>
</configuration>


After Rewrite takes effect, please select "Open" to submit in the background of website = "Website Settings =" SEO Optimization = "URL Rewrite.

Then enter the module setting "SEO Setting" of each module to select the corresponding pseudo-static address rule

Select "Update Address" to submit.


Related articles: