Home  >  Article  >  Backend Development  >  织梦安装在二级目录,如何写伪静态?

织梦安装在二级目录,如何写伪静态?

WBOY
WBOYOriginal
2016-06-06 20:37:591426browse

织梦安装在二级目录,如何写伪静态?,我使用网站上的方法,打开页面是空白。一般设置有问题的话,会显示404,但这个是空白页,不知道是什么原因。

回复内容:

织梦安装在二级目录,如何写伪静态?,我使用网站上的方法,打开页面是空白。一般设置有问题的话,会显示404,但这个是空白页,不知道是什么原因。

1)IIS伪静态

<code>打开httpd.ini文件,加入如下规则:
#首页伪静态规则,如果不使用动态首页,请勿必删除这一行,否则打开首页会出现死循环
RewriteRule ^(.*)/index\.html $1/index\.php [I]
#列表页伪静态规则
RewriteRule ^(.*)/category/list-([0-9]+)\.html $1/plus/list\.php\?tid=$2 [I]
RewriteRule ^(.*)/category/list-([0-9]+)-([0-9]+)-([0-9]+)\.html $1/plus/list\.php\?tid=$2&TotalResult=$3&PageNo=$4 [I]
#文章页伪静态规则
RewriteRule ^(.*)/archives/view-([0-9]+)-([0-9]+)\.html $1/plus/view\.php\?arcID=$2&pageno=$3 [I]
#搜索伪静态规则
RewriteRule ^(.*)/search\.html(?:(\?.*))* $1/search\.php?$2 [I]
#TAG标签伪静态规则
RewriteRule ^(.*)/tags\.html $1/tags\.php [I]
RewriteRule ^(.*)/tags/(.*)(?:(\?.*))* $1/tags\.php\?\/$2 [I]
RewriteRule ^(.*)/tags/(.*)\/(?:(\?.*))* $1/tags\.php\?\/$2\/ [I]
RewriteRule ^(.*)/tags/(.*)\/([0-9])(?:(\?.*))* $1/tags\.php\?\/$2\/$3 [I]
RewriteRule ^(.*)/tags/(.*)\/([0-9])\/(?:(\?.*))* $1/tags\.php\?\/$2\/$3\/ [I]
#问答伪静态规则,适用于DedeCmsV5.3-5.6版本,需要修改几处程序
RewriteRule ^(.*)/post\.html $1/post\.php [I]
RewriteRule ^(.*)/type\.html $1/type\.php [I]
RewriteRule ^(.*)/question-([0-9]+)\.html $1/question\.php\?id=$2 [I]
RewriteRule ^(.*)/browser-1-([0-9]+)\.html $1/browser\.php\?tid=$2 [I]
RewriteRule ^(.*)/browser-2-([0-9]+)\.html $1/browser\.php\?tid2=$2 [I]
RewriteRule ^(.*)/browser-1-([0-9]+)-([0-9]+)\.html $1/browser\.php\?tid=$2&page=$3 [I]
RewriteRule ^(.*)/browser-2-([0-9]+)-([0-9]+)\.html $1/browser\.php\?tid2=$2&page=$3 [I]
RewriteRule ^(.*)/browser-([0-9]+)\.html $1/browser\.php\?lm=$2 [I]
RewriteRule ^(.*)/browser-1-([0-9]+)-([0-9]+)\.html $1/browser\.php\?tid=$2&lm=$3 [I]
RewriteRule ^(.*)/browser-2-([0-9]+)-([0-9]+)\.html $1/browser\.php\?tid2=$2&lm=$3 [I]
</code>

2)Apache伪静态
打开.htaccess文件,加入如下规则:

提供部分规则作参考

RewriteRule ^category/list-([0-9]+).html$ /plus/list.php?tid=$1
RewriteRule ^category/list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3
RewriteRule ^archives/view-([0-9]+)-([0-9]+).html$ /plus/view.php?arcID=$1&pageno=$2

注意:规则开头必须加

<code># 将 RewriteEngine 模式打开
RewriteEngine On

# 修改以下语句中的 /dedecms 为dedecms安装目录,程序放在根目录中,请将 /dedecms 修改为 /
RewriteBase /dedecms 
</code>

.htaccess放在根目录
规则请自行百度or Google,现在只说明一下放规则的细节,话说规则可以按需自己写(前提你要有一定的经验Or Confidence)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn