Loading... <p>XiunoBBS 只需要一条规则:</p><p>将 <em>.htm</em> 转发到 index.php?<em>.htm</em> 即可。</p><p>Xiuno BBS 4.0 / 2.0 需要编辑 conf/conf.php</p><ol><li>编辑 'url_rewrite_on'=>1,</li><li>清空 tmp 目录</li></ol><p>Nginx:</p><p>打开 nginx 配置文件 /usr/local/nginx/conf/nginx.conf 找到对应的虚拟主机配置处,追加加粗行:</p><p>location / {</p><pre><code>rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last; index index.html index.htm index.php; root /data/wwwroot/xiuno.com; </code></pre><p>}</p><p>然后重新启动 nginx: service nginx restart</p><p>Apache: </p><p>vim /etc/httpd/conf/httpd.conf</p><p><Directory d:/xiuno.com></p><pre><code>Options FollowSymLinks ExecCGI Indexes AllowOverride all Order deny,allow Allow from all Satisfy all </code></pre><p></Directory></p><p>NameVirtualHost *:80</p><p>Apache .htaccess</p><p>如果Appache 支持 .htaccess,那么可以编辑 .htaccess 文件放置于根目录下:</p><p><IfModule mod_rewrite.c></p><p>RewriteEngine on</p><p>RewriteRule ^(.<em>?)(<sup id="fnref-1"><a href="#fn-1" class="footnote-ref">1</a></sup></em>).htm(.*)$ $1/index.php?$2.htm$3 [L]</p><p></IfModule></p><p>Apache httpd.conf</p><p>如果将规则直接放入 httpd.conf 则需要在前面加 / ,看来 Apache 也反人类:</p><p><IfModule mod_rewrite.c></p><p>RewriteEngine on</p><p>RewriteRule ^(.<em>?)(<sup id="fnref-1"><a href="#fn-1" class="footnote-ref">1</a></sup></em>).htm(.*)$ $1/index.php?$2.htm$3 [L]</p><p></IfModule></p><p>SAE环境,根目录建立 config.yaml 文件:</p><p>appname: axiuno</p><p>version: 1</p><p>handle:</p><ul><li>rewrite: if ( !is_dir() && !is_file() && path ~ "admin/(.*.htm)" ) goto "admin/index.php?%1"</li><li>rewrite: if ( !is_dir() && !is_file() && path ~ "<sup id="fnref-2"><a href="#fn-2" class="footnote-ref">2</a></sup>.htm" ) goto "index.php?%1"</li></ul><p>IIS:</p><ol><li>下载附件</li><li>解压到 c:Rewrite</li><li>在IIS的Isapi上添加这个筛选器, 筛选器名称Rewrite,可执行文件选择 Rewrite.dll</li><li>重新启动IIS</li><li>httpd.ini 是配置文件,如果您了解Rewrite 规则,可以直接对其进行编辑,以下为包内设置好的Xiuno BBS的规则:<br>[ISAPI_Rewrite]</li></ol><h1>3600 = 1 hour</h1><p>CacheClockRate 3600<br>RepeatLimit 32</p><h1>RewriteRule .*.(?:gif|jpg|png|css|js|txt|jpeg|swf|flv) $0 [I,L]</h1><h1>RewriteRule /httpd(?:.ini|.parse.errors) / [F,I,O]</h1><p>RewriteCond %{REQUEST_FILENAME} !-f<br>RewriteCond %{REQUEST_FILENAME} !-d</p><p>RewriteRule ^/admin(.<em>).htm(.</em>) /admin/index.php?$1.htm$2 [L]<br>RewriteRule ^(.<em>).htm(.</em>) /index.php?$1.htm$2 [L]</p><p>另外一种 IIS Rewrite:<br>[ISAPI_Rewrite]</p><h1>3600 = 1 hour</h1><p>CacheClockRate 3600<br>RepeatLimit 32<br>RewriteCond %{REQUEST_FILENAME} !-f<br>RewriteCond %{REQUEST_FILENAME} !-d<br>RewriteRule ^/admin/(.<em>).htm(.</em>) /admin/$1.htm$2 [L]<br>RewriteRule ^(.<em>).htm(.</em>)$ /$1.htm$2 [L]</p><p>如果要放到目录下,比如 bbs 目录,在 rewrite 规则前面加上目录即可,比如 apache .htaccess:<br><IfModule mod_rewrite.c><br>RewriteEngine on<br>RewriteCond %{REQUEST_FILENAME} !-d<br>RewriteCond %{REQUEST_FILENAME} !-f<br>RewriteRule ^bbs/admin/(.<em>).htm(.</em>)$ /admin/index.php?$1.htm$2 [L]</p><p>RewriteRule ^bbs/(.<em>).htm(.</em>)$ /index.php?$1.htm$2 [L]</p><p></IfModule></p><p>IIS 的高版本配置方法:</p><p>Xiuno3 IIS7,IIS7.5伪静态规则,懒人版<br><?xml version="1.0" encoding="UTF-8"?><br><configuration><br><system.webServer><br><rewrite><br><rules><br><rule name="xiuno3"><br><match url="^((.*)/)?(.+).htm$" /><br><action type="Rewrite" url="{R:1}index.php?{R:2}.htm" /><br></rule><br></rules><br></rewrite><br></system.webServer><br></configuration></p><div class="footnotes"><hr><ol><li id="fn-1">/ <a href="#fnref-1" class="footnote-backref">↩</a></li><li id="fn-2">/? <a href="#fnref-2" class="footnote-backref">↩</a></li></ol></div> Last modification:October 23rd, 2020 at 10:48 pm © 允许规范转载 Support 如果觉得我的文章对你有用,请随意赞赏 ×Close Appreciate the author Sweeping payments Pay by AliPay Pay by WeChat