XiunoBBS 只需要一条规则: 将 *.htm* 转发到 index.php?*.htm* 即可。
$ s8 M6 f. H7 e' q2 |0 q$ [( [Xiuno BBS 4.0 需要编辑 conf/conf.php 1. 编辑 'url_rewrite_on'=>1, 2. 清空 tmp 目录 - w& l o1 R3 o$ f5 f3 X# x
/ S+ h# ^# x- w* V2 XNginx: 打开 nginx 配置文件 /usr/local/nginx/conf/nginx.conf 找到对应的虚拟主机配置处,追加加粗行: ' Q; ^, L0 L5 t; s! h0 c; s% x* i
location ~* \.(htm)$ { rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last; }
# X: c& |: x! o% I' g然后重新启动 nginx: service nginx restart * n' e" l9 L: M0 u
Apache: 4 I& h! `+ ~1 H! E- O1 F. N3 N1 K
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
5 P) x. K; u8 q) O% p1 X$ uApache .htaccess 如果Appache 支持 .htaccess,那么可以编辑 .htaccess 文件放置于根目录下: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L] </IfModule>
) \/ }6 x: H4 G ?Apache httpd.conf5 X% x; o% G* K- M1 n# }/ Q
如果将规则直接放入 httpd.conf 则需要在前面加 / ,看来 Apache 也反人类: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L] </IfModule>
& T9 K/ n2 t& x2 _, c- D$ ~' ^ l( r5 z1 f' b
SAE环境,根目录建立 config.yaml 文件: appname: axiuno" w0 Z ^# G% a% C
version: 19 ]# q. e& T8 C! @
handle:
8 r s9 H& X$ C- 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"
$ h, i5 l" }/ n6 _0 a
# v4 J1 u8 J; O4 R# N9 o J9 s# W& p3 R) l) y
IIS:
/ U( A* U5 ]" J 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]9 H% j* v6 Q, ^$ d5 s T7 ^! O; N
RewriteRule ^(.*)\.htm(.*) /index.php?$1.htm$2 [L]
- N# c5 R4 c, I' P" _2 b
" d1 L5 c( q6 W' Z" x2 d" H# d, E% J! a8 r) k2 Q5 Y! z, I
6 I7 g+ I. _6 |2 p% s0 o, l另外一种 IIS Rewrite: [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] $ T$ E* a4 q0 ^3 I: o+ X% p/ @
: E" h- e" I# Q5 A9 j# n2 x8 v/ b9 E5 w如果要放到目录下,比如 bbs 目录,在 rewrite 规则前面加上目录即可,比如 apache .htaccess:
/ E9 v9 S* p3 e; o* b <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] 0 l' |. J/ y4 L6 k! J/ Y
RewriteRule ^bbs/(.*)\.htm(.*)$ /index.php?$1.htm$2 [L]
4 o! F6 c3 g# K: g. {</IfModule> & S2 N; g( \! Z5 I
IIS 的高版本配置方法:
8 N6 @/ a7 Z& s6 z* u4 U" C+ l
3 |, }% f4 K: p" b, hIIS Rewrite 支持 Apache .htaccess
【魔趣吧资源下载指南】--默认解压密码:www.moqu8.com
1,如有异常请按 F5 刷新本页面!
【资源维权反馈】
2,首发及精品资源受到保护,扣除趣币!趣币可通过分享资源免费获得!懒人也可选择充值!
|