发一个Xiuno BBS伪静态设置的教程,主题网教程试了无效的看这篇!

看到别人用Xiuno·Light这个程序+主题做的网站7个月Bing权重做到6,我就也想去做一个试试,花了两天时间,最终还是把整站删了,确实是卡啊!

也遇到了伪静态不生效的问题,那些论坛社区教的就没说到重点,我直接把重点放到最前面,省的浪费你们的之间。

最重要的一步

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

这个是网站内的conf.php文件,不是服务器的运行环境,可能其它教程里说了,没标重点我忽略了,这个本应该出现在网站后台设置里的,开发者没加上项目就不做了,豆包一直让我在后台打开伪静态,我一直没找到,原来是要编辑这个文件。

不同环境配置伪静态规则

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
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧

猜你喜欢

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索