XiunoBBS伪静态设置方法

cindy  (UID: 38) 3月前 [复制链接]
帖子链接已复制到剪贴板

109 2

XiunoBBS 只需要一条规则:

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

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

1. 编辑 'url_rewrite_on'=>1,

2. 清空 tmp 目录

Nginx:

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

markup
rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last; index    index.html index.htm index.php; root     /data/wwwroot/xiuno.com }

然后重新启动 nginx: service nginx restart

Apache: 

vim /etc/httpd/conf/httpd.conf

markup
<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 文件放置于根目录下:

markup
<IfModule mod_rewrite.c>

RewriteEngine on

RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L]

</IfModule>

Apache httpd.conf

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

markup
<IfModule mod_rewrite.c>

RewriteEngine on

RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L]

</IfModule>

SAE环境,根目录建立 config.yaml 文件:

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"

IIS:建议用宝塔配置更方便

markup
<?xml version="1.0" ?>

<rules>

    <rule name="xiuno3_rewrite">

        <match url="^((.*)/)?(.+).htm$"/>

        <action type="Rewrite" url="{R:1}\index.php?{R:2}.htm"/>

    </rule>

</rules>
这家伙太懒了,什么也没留下。
已有回复 (2)
  • 喵小呜  (UID: 53) @Ta
    26天前
    沙发
    楼主太厉害了!楼主,666!
  • 彩虹小牛马  (UID: 77) @Ta
    2天前
    椅子
    社区不能没有像楼主这样的人才啊!
    • Xiuno BBS
      3
发新帖
推广 (站长QQ:837054936)