xiuno开启伪静态教程
xiunoa 2020-7-17

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 找到对应的虚拟主机配置处,追加加粗行:

location / { 

    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

<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>


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: 

1. 下载附件

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]




另外一种 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]



如果要放到目录下,比如 bbs 目录,在 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 的高版本配置方法:

Xiuno3 IIS7,IIS7.5伪静态规则,懒人版

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="xiuno3">
<match url="^((.*)/)?(.+).htm$" />
<action type="Rewrite" url="{R:1}\index.php?{R:2}.htm" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>


IIS Rewrite 支持 Apache .htaccess :下载附件2

反人类的 IIS REWRITE!!!


上传的附件:
最新回复 (13)
全部楼主
  • 小鹿
    2020-11-6 2
    0
    啊啊~
  • 熊猫大王
    2020-11-10 3
    0
    支持
  • xf5423
    2020-11-14 4
    0
    。什么东西啊
  • xiaoshun66
    2022-4-19 5
    0
    积分 不够啊
  • moduo320
    2022-5-1 6
    0
    楼主,我只是来混个熟的!老板,侬亿雷凑闹嫩了!
  • 430135421
    2022-9-13 7
    0
    感谢楼主ing!!!
  • qiange2018
    2022-10-21 8
    0
    我设置之后首页打不开 其他页面正常
  • yao
    2022-11-9 9
    0
    放在二级目录,后台无法正常使用,试着按教程的加入bbs/admin还是不能正常访问后台,前台能访问
  • xiaoheizi
    2022-11-23 10
    0
    楼主,你写得实在是太好了。我惟一能做的,就只有把这个帖子顶上去这件事了。 
  • scren
    5月前 11
    0
    这个积分怎么算的
  • scren
    5月前 12
    0
    子目录测试了肯定不行
  • 浅唱 站长
    5月前 13
    0
    scren 这个积分怎么算的
    请看积分规则帖子
  • ruixing0731
    1月前 14
    0
    开了还是显示?号
返回