Xiuno BBS伪静态设置后没有效果,这才是真正的步骤,免费发教程了!

用了2天Xiuno BBS,只能说真的好卡,Discuz!流畅太多了,大哥还是大哥,虽然归来晚了,做论坛这块流畅对还是没得说。然后我把Xiuno BBS整站删除了。

过程中,有遇到伪静态无效的问题,我用的是宝塔+Apache,当然,我会把Nginx和IIS、Caddy、SAE、WDCP这些环境的都发出来。

第一步:HTTP服务器设置

XiunoBBS 伪静态设置规则:将 *.htm* 转发到 index.php?*.htm* 

Nginx

在nginx配置文件的server节点下新增如下内容:

location ~* \.(htm)$ {
        rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;
    }

修改后重启nginx服务

Apache

如果Appache 支持 .htaccess,可以在网站根目录创建文件 .htaccess,内容如下:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?)([^/]*)$ $1index.php?$2[QSA,PT,L]
</IfModule>

也可以修改httpd.conf,如果将规则直接放入 httpd.conf 则需要在前面加 / 

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L]
</IfModule>

IIS

修改web.config

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

Caddy

www.yourdomain.com

# Set this path to your site's directory.
root * /var/www

file_server

# Or serve a PHP site through php-fpm:
php_fastcgi localhost:9000

SAE

如果是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"

WDCP

WDCP是一套Linux下的虚拟主机管理软件,总结下几个要点:

  • 只启用 apache 模式(内含 nginx, nginx+apache 其他模式)。
  • 添加rewrite 规则,名字叫:xiuno_apache.conf
  • 站点编辑,启用xiuno_apache.conf,内容:
RewriteEngine on
RewriteRule ^/admin/([^/]+)\.htm$ /admin/index.php?$1.htm [L]
RewriteRule ^/([^/]+)\.htm$ /index.php?$1.htm [L]
  • 重启 web server

第二步:XiunoBBS网站配置

修改conf/conf.php,将url_rewrite_on 改成1,然后在后台清理缓存。

注意:最重要的是第二步,无效都是大多数教程里没有说第二步,这个本应该出现在网站后台设置里的,相当于网站设置里打开伪静态,可能是开发者还没写进去项目就停了。

我就是豆包一直和我说要在后台开启伪静态,我在后台所有都看了,就是没看到这个设置,是要手动去编辑这个文件的。

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
鹿鹿的头像-十二部社区
评论 抢沙发

请登录后发表评论

    暂无评论内容