万众海浪论坛  
温馨提示今天是:

当网络繁忙时请选择:https://bbs.838778.com(线路一)https://bbs.939138.com(线路二)进入本站论坛。


 
标题: 修罗关于 如何设置Xiuno BBS URL-Rewrite(伪静态设定)
万众海浪
管理员
Rank: 12Rank: 12Rank: 12



UID 915
精华 1
积分 48128
帖子 1085
威望 48128 点
金钱 50235 RMB
阅读权限 200
注册 2005-6-20
状态 离线
 
发表于 2020-3-16 14:37  资料  个人空间  短消息  加为好友 
修罗关于 如何设置Xiuno BBS URL-Rewrite(伪静态设定)

XiunoBBS 只需要一条规则:

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



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

1. 编辑 'url_rewrite_on'=>1,

2. 清空 tmp 目录





Nginx:

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



location ~* \.(htm)$ {

    rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;

}



然后重新启动 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



# Apache 2.4

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*?)([^/]*)$ $1index.php?$2 [QSA,PT,L]



# Apache other

#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. 下载 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]





另外一种 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 的高版本配置方法:

IIS 的高版本配置方法1:http://bbs.xiuno.com/thread-9008.htm

IIS 的高版本配置方法2:http://bbs.xiuno.com/thread-9411.htm

IIS 的详细配置方法请参看:http://my.oschina.net/lyx2012/blog/60198



IIS Rewrite 支持 Apache .htaccess :ISAPI_Rewrite3.zip   



反人类的 IIS REWRITE!!!


由于后台下载了一个QQ互联的插件,然后万事俱备,只差回调地址,结果怎么也不行,最后通过URL转换看到地址,中间多了个问号,发现应该是没有伪静态。

以前是用IIS的,现在租用的虚拟主机用的Linux,所以用的规则如下:

<IfModule mod_rewrite.c>
RewriteEngine on
# Apache 2.4
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?)([^/]*)$ $1index.php?$2 [QSA,PT,L]
# Apache other
#RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L]
</IfModule>
但我发现,无论我改成了什么,无论我找了N多都不行。

最后我去配置文件中看了看,发现了一句有用的

路径:网站目录\conf\conf.php

        /* 支持多种 URL 格式:
        0: ?thread-create-1.htm
        1: thread-create-1.htm
        2: ?/thread/create/1  不支持
        3: /thread/create/1   不支持
    */
    'url_rewrite_on' => 0,


默认是等于0的,所以,这里要改成 1,然后刷新网站发现,OK了,QQ可以正常登录。

不过QQ登录不能绑定到原来的账号,所以是相当于新注册了一个账号。

官方也是一样的,我原来的账号和现在的账号都不是同一个了,不过原来的账号忘记了密码了。

希望老大和大佬们能够把这个伪静态的问题整理一下。
https://bbs.xiuno.com/thread-2.htm

顶部
 

 

本站永久域名①:www.838668.com (点击加入您的收藏夹)

当前时区 GMT+8, 现在时间是 2024-3-28 21:10

     Powered by Discuz! 5.5.0  © 2001-2007, Skin by Cool
Clear Cookies - Contactus - 万众海浪论坛 - Archiver - wap