宝塔安装HYBBS论坛程度,伪静态的设置方法
宝塔安装 伪静态 ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;">站点设置->伪静态->请根据自己的环境输入以下代码保存ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;"> ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;">Apache:ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;"> ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;"><IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule> ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;"> ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;">nginx:if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
} ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;">Apache 伪静态 ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;">Apache的伪静态是最简单 易用的. ingFang SC", "Lantinghei SC", "Microsoft Yahei", "Hiragino Sans GB", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans;">直接在网站根目录下创建文件: .htaccess (注意: 不要在前面加什么 x.htaccess . 该文件不需要文件名 只需要后缀)
写入内容: <IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule> 如果完成以上操作 依然无法使用. 那可能是你的Apache为开启伪静态模块 在Apache 安装目录中找到 conf/httpd.conf 文件 在该文件中搜索 : mod_rewrite 即可找到关键字 #LoadModule rewrite_module modules/mod_rewrite.so 如果你看到 前面有一个# 号 说明伪静态模块并未开启 所以你需要将 #号去除, 保存文件 重启Apache进程即可! 不会重启Apache的 请重启主机吧!
Nginx
Nginx的伪静态安装时比较麻烦的, 因为Nginx一般会在Linux下安装使用, 空间以及Windows用的较少. 你需要来到Nginx的Conf目录 这里用LNMP的安装目录作为说明 LNMP中的Nginx目录在 /usr/local/nginx中 # cd /usr/local/nginx/conf/vhost 在目录中找到你的网站目录vhost (这里可能有人不理解 我也不知道怎么说的明白) # vi 你的目录名.conf 打开文件后可见内容: server
{
listen 80;
#listen [::]:80;
server_name bbs.hyphp.cn bbs.hyyyp.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/bbs.hyphp.cn;
include other.conf;
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
......
........
...
省略.. 在中间插入: if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
} server
{
listen 80;
#listen [::]:80;
server_name bbs.hyphp.cn bbs.hyyyp.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/bbs.hyphp.cn;
include other.conf;
#error_page 404 /404.html;
include enable-php.conf;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
} 插入后就是上面的结构了 保存该Conf即可 重启Nginx 完成
IIS 7 以上IIS7版本以上安装了URL重写支持才会支持 Web.config 伪静态 在根目录写入以下内容 保存为 Web.config <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?s={R:1}" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="false" />
<security>
<requestFiltering allowDoubleEscaping="True" />
</security>
</system.webServer>
</configuration>
|