收藏本站扫码开通

套图久久-最强写真套图合集打包全集下载-Graphis-S-Cute-ROSI-秀人等

 找回密码
 这里注册

QQ登录

只需一步,快速开始

查看: 746|回复: 0
打印 上一主题 下一主题

[经验技巧] Discuz!系列教程-通过判断空间类型选择伪静态方式

[复制链接]
百图阁图友
跳转到指定楼层
楼主
百图阁图友 发表于 2017-7-21 10:15:05 回帖奖励 |倒序浏览 |阅读模式

点击上方获取邀请码注册baituge.com,100TB套图视频等你下载!

您需要 登录 才可以下载或查看,没有帐号?这里注册

x
程序版本:Discuz!x1.5-x3.1
目的:给新手认清空间类型,从而选择合适的伪静态方式
适合人群:使用Discuz!x1.5-x3.1的站长

具体内容:
1.后台,登录,首页会看到这样的一张图:
无限星辰工作室www.xmspace.net伪静态教程

                               
登录/注册后可看大图

2.仔细看这内容:


可能的组合有:
(1)服务器系统及 PHP:WINNT / PHP v5.X.X 服务器软件:Microsoft-IIS/6.0
这时候选择的伪静态规则对应的是:IIS Web Server(独立主机用户)
  • [ISAPI_Rewrite]
  • # 3600 = 1 hour
  • CacheClockRate 3600
  • RepeatLimit 32
  • # Protect httpd.ini and httpd.parse.errors files
  • # from accessing through HTTP
  • RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4
  • RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5
  • RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5
  • RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
  • RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5
  • RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5
  • RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5
  • RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5
  • RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html(\?(.*))*$ $1/plugin\.php\?id=$23&$5
复制代码将以上内容保存为httpd.ini 上传到网站根目录
(2)服务器系统及 PHP:WINNT / PHP v5.2.16 服务器软件:Microsoft-IIS/7.X
这时候选择的伪静态规则对应的是:IIS7 Web Server(独立主机用户)
规则文件:web.zip(656 Bytes, 下载次数: 2342)2013-1-6 01:45 上传点击文件名下载附件
备注:对应虚拟空间的用户上传这个规则就可以了,如果空间商有自定义规则方式需要和空间商客服核实下(万网是自定义规则)或者可以QQ咨询。如果是独立主机涉及到伪静态组件设置,就不在这里另外说明了。

(3)服务器系统及 PHP : Linux / PHP v5.X.X 服务器软件:Apache
这时候选择的伪静态规则对应的是:Apache Web Server(虚拟主机用户)
  • # 将 RewriteEngine 模式打开
  • RewriteEngine On
  • # 修改以下语句中的 /discuz 为您的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
  • RewriteBase /
  • # Rewrite 系统规则请勿修改
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$12&%1
复制代码以上规则具体如何使用见http://www.discuz.net/thread-3191754-1-1.html

这时候会有人有疑问了:
如果是独立主机会有独立的httpd-vhosts.conf配置文件,可以在这个文件的网站配置字段中加入:
  • <IfModule mod_rewrite.c>
  • RewriteEngine On
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$23&%1
  • </IfModule>
复制代码这些规则内容。
一个案例:
  • <VirtualHost *:80>
  • DocumentRoot /home/xmspace
  • ServerName www.xmspace.net
  • <IfModule mod_rewrite.c>
  • RewriteEngine On
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3&%1
  • RewriteCond %{QUERY_STRING} ^(.*)$
  • RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$23&%1
  • </IfModule>
  • </VirtualHost>
复制代码(4)服务器系统及 PHP : Linux / PHP v5.X.X 服务器软件:Nginx
这时候选择的伪静态规则对应的是:Nginx Web Server
如果选择的是独立服务器下面给一个案例:

vi /usr/local/nginx/conf/nginx.conf #编辑nginx配置文件
找到下面这行,在server_name localhost;后边一行添加上面的代码
  • server {
  • listen 80;
  • server_name localhost;
  • rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  • rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  • rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  • rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  • rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  • rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  • rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
  • rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
  • rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$23 last;
  • if (!-e $request_filename) {
  • return 404;
  • }
  • #access_log logs/host.access.log main;
  • location / {
  • root html;
  • index index.php index.html index.htm;
  • }
复制代码如果是虚拟主机一般支持.htaccess

直接将:
  • rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  • rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  • rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  • rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  • rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  • rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  • rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
  • rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
  • rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$23 last;
  • if (!-e $request_filename) {
  • return 404;
  • }
复制代码保存为.htaccess上传网站根目录,再测试是否成功,由于各家空间商的规则设置方式不同,有些使用的是自己的后台空间管理界面设置,所以在使用时还是咨询下空间商客服。[/hide]

最后一种是Zeus Web Server模式,这个由于使用相对较少,如遇到可以直接咨询空间商或QQ我

以上就是如果给新手用于判断空间类型,选择合适伪静态教程。

==================================================
另一种
程序版本:Discuz!x2.5
目的:实现站点伪静态,对百度seo比较好
适合人群:使用Apache虚拟空间的Discuz!x2.5站长

具体实施方法:
1.登录后台,依次打开全局-Seo设置,将URL 静态化界面下的规则后面的可用勾选,提交一次。


                               
登录/注册后可看大图


2.重新回到全局-Seo设置,点击 ”查看当前的 Rewrite 规则URL 静态化“,选择Apache Web Server(虚拟主机用户)这个规则复制复制代码
[hide]3.新建文本文件(用记事本或ultraEdit),将以上内容填入,另存文件,保存的时候选择所有文件,文件名为.htaccess

                               
登录/注册后可看大图


4.将.htaccess文件上传到网站根目录

5.完成


回复

使用道具 举报

 点击右侧快捷回复【勿回复无意义内容 违者封禁】  【taotufabu.com】
您需要登录后才可以回帖 登录 | 这里注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

点击上方获取邀请码即可注册!登陆后可浏览所有秘密板块!100T资源等你来下载!地址发布页taotufabu.com
 这里注册
找回密码

QQ|Archiver|手机版|套图久久-最强套图下载站  |网站地图  

GMT+8, 2024-5-6 10:47 , Processed in 0.079150 second(s), 35 queries .

Powered by Discuz! X3.2

© 2015-2020 套图发布

快速回复 返回顶部 返回列表