设置Xiuno BBS URL-Rewrite(伪静态设定)

冬月初五 4月前 364

Xiuno BBS 只需要一条规则:

将 *.htm* 转发到 index.php?*.htm* 即可。

Xiuno BBS 4.0  需要编辑 conf/conf.php

  • 1 编辑 'url_rewrite_on'=>1,
  • 2 清空 tmp 目录 

1 打开 nginx 配置文件 /usr/local/nginx/conf/nginx.conf 找到对应的虚拟主机配置处,追加加粗行:

location ~* \.(htm)$ {
   rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;
}

2 然后重新启动 nginx: service nginx restart

vim /etc/httpd/conf/httpd.conf
<Directory d:/xiuno.com>
   Options FollowSymLinks ExecCGI Indexes
   AllowOverride all
   Order deny,allow
   Allow from all
   Satisfy all
</Directory>
NameVirtualHost *:80

Apache .htaccess

如果Appache 支持 .htaccess,那么可以编辑 .htaccess 文件放置于根目录下:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L]
</IfModule>

Apache httpd.conf

如果将规则直接放入 httpd.conf 则需要在前面加 / ,看来 Apache 也反人类:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L]
</IfModule>

appname: axiuno
 version: 1
 handle:
 - rewrite: if ( !is_dir() && !is_file() && path ~ "admin/(.*.htm)" ) goto "admin/index.php?%1"
 - rewrite: if ( !is_dir() && !is_file() && path ~ "[^/?].htm" ) goto "index.php?%1"

1 下载 Rewrite.zip

2 解压到 c:\Rewrite

3 在IIS的Isapi上添加这个筛选器, 筛选器名称Rewrite,可执行文件选择 Rewrite.dll

4 重新启动IIS

5 httpd.ini 是配置文件,如果您了解Rewrite 规则,可以直接对其进行编辑,以下为包内设置好的Xiuno BBS的规则:

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
#RewriteRule .*\.(?:gif|jpg|png|css|js|txt|jpeg|swf|flv) $0 [I,L]
#RewriteRule /httpd(?:\.ini|\.parse\.errors) / [F,I,O]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/admin(.*)\.htm(.*) /admin/index.php?$1.htm$2 [L]
RewriteRule ^(.*)\.htm(.*) /index.php?$1.htm$2 [L]

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/admin/(.*)\.htm(.*) /admin/$1.htm$2 [L]
RewriteRule ^(.*)\.htm(.*)$ /$1.htm$2 [L]

在 rewrite 规则前面加上目录即可,比如 apache .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^bbs/admin/(.*)\.htm(.*)$ /admin/index.php?$1.htm$2 [L]
RewriteRule ^bbs/(.*)\.htm(.*)$ /index.php?$1.htm$2 [L]
</IfModule>

IIS Rewrite 支持 Apache .htaccess :ISAPI_Rewrite3.zip   

反人类的 IIS REWRITE!!!

WDCP是一套Linux下的虚拟主机管理软件, 总结下几个要点:

1 只启用 apache 模式(内含 nginx, nginx+apache 其他模式)。

2  添加rewrite 规则,名字叫:xiuno_apache.conf

3 站点编辑,启用xiuno_apache.conf,内容:

RewriteEngine on    //必须要有
RewriteRule ^/admin/([^/]+)\.htm$ /admin/index.php?$1.htm [L]
RewriteRule ^/([^/]+)\.htm$ /index.php?$1.htm [L]

4 重启 web server

 

转自:
https://bbs.xiuno.com/thread-2.htm



最新回复 (0)
    • jilu.wiki
      2
        立即登录 立即注册 
返回
文章系网友原创或转载,目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵权行为,请联系我们admin(a)jilu.wiki,我们会及时删除。