wordpress怎么设置静态化(HTTP 错误 404.0 – Not Found)

- 作者:小小课堂SEO自学网 - 阅 1,771   推荐

wordpress怎么设置静态化?IIS7.5不自带URL Rewrite模块,所以,当WordPress设置伪静态时,可能会出现“HTTP 错误 404.0 – Not Found”的问题。今天,小小课堂SEO自学网 xxkt.org.cn 为大家带来的是《wordpress怎么设置静态化(HTTP 错误 404.0 – Not Found)》的解决办法。希望本次的建站教程对大家有所帮助。

IIS7.5设置伪静态

一、WordPress设置伪静态出错

WP伪静态是需要设置的,马慧SEO认为默认的URL链接形式并不友好。

合理的应该为:栏目末尾有斜杠,页面末尾有.html。

① 斜杠

这段代码加到 主题文件的functions.php中即可解决。

function nice_trailingslashit($string, $type_of_url) {

if ( $type_of_url != ‘single’ && $type_of_url != ‘page’ && $type_of_url != ‘single_paged’ )

$string = trailingslashit($string);

return $string;

}

add_filter(‘user_trailingslashit’, ‘nice_trailingslashit’, 10, 2);

② 末尾.html

文章末尾加.html的方法,直接设置固定链接-自定义结构即可,这样设置完成之后,文章页面的URL就变成了.html了,但单页面还是没有html,个人认为这样的效果就可以了。单页面URL与文章不同也是可以的。

/%category%/%post_id%.html

固定链接-自定义结构

但是设置完成后,可能就会出现以下错误:

HTTP 错误 404.0 – Not Found 您要找的资源已被删除、已更名或暂时不可用。

指定的目录或文件在 Web 服务器上不存在。

URL 拼写错误。

某个自定义筛选器或模块(如 URLScan)限制了对该文件的访问。

模块 IIS Web Core

通知 MapRequestHandler

处理程序 StaticFile

错误代码 0x80070002

错误

二、URL Rewrite模块下载与安装

Windows 2008的服务器一般为IIS7.5,不自带URL Rewrite模块,所以,需要先去微软官网下载。x86适合32位系统,x64适合64位系统。

官方下载地址:https://www.iis.net/downloads/microsoft/url-rewrite

百度云下载地址:https://pan.baidu.com/s/1IDet5Pv4gIiMwL-tMioKbg

将文件下载下来之后,直接上传至服务器就可以进行安装了,安装完成之后,记得重启一次就好。

另外,别在官方下载错了哦~

URL Rewrite模块下载

三、最后的操作-修改web.config

增加内容如下:

<rule name=”WordPress:  https://xxkt.org.cn ” patternSyntax=”Wildcard”>

<match url=”*” />

<conditions>

<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />

<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />

</conditions>

<action type=”Rewrite” url=”index.php” />

</rule>

<rule name=”WordPress Rule 1″ stopProcessing=”true”>

<match url=”^index\.php$” ignoreCase=”false” />

<action type=”None” />

</rule>

<rule name=”WordPress Rule 2″ stopProcessing=”true”>

<match url=”^wp-admin$” ignoreCase=”false” />

<action type=”Redirect” url=”wp-admin/” redirectType=”Permanent” />

</rule>

<rule name=”WordPress Rule 3″ stopProcessing=”true”>

<match url=”^” ignoreCase=”false” />

<conditions logicalGrouping=”MatchAny”>

<add input=”{REQUEST_FILENAME}” matchType=”IsFile” ignoreCase=”false” />

<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” ignoreCase=”false” />

</conditions>

<action type=”None” />

</rule>

<rule name=”WordPress Rule 4″ stopProcessing=”true”>

<match url=”^(wp-(content|admin|includes).*)” ignoreCase=”false” />

<action type=”Rewrite” url=”{R:1}” />

</rule>

<rule name=”WordPress Rule 5″ stopProcessing=”true”>

<match url=”^([_0-9a-zA-Z-]+/)?(.*\.php)$” ignoreCase=”false” />

<action type=”Rewrite” url=”{R:2}” />

</rule>

<rule name=”WordPress Rule 6″ stopProcessing=”true”>

<match url=”.” ignoreCase=”false” />

<action type=”Rewrite” url=”index.php” />

</rule>

以上就是小小课堂SEO自学网( xxkt.org.cn )为大家带来的是《wordpress怎么设置静态化(HTTP 错误 404.0 – Not Found)》的解决办法。感谢您的阅读。SEO技术培训认准小小课堂!

本文最后一次更新时间:2022年2月28日

本文《wordpress怎么设置静态化(HTTP 错误 404.0 – Not Found)》由小小课堂网整理或原创,侵删,欢迎转载并保留版权:https://xxkt.org.cn/ 感谢您的阅读。

本站提供SEO培训、咨询、诊断,QQ:2216876660 微信:huowuyan 公众号:小小课堂网

标签:

相关文章!
error: Content is protected !!