雪山凌狐 发表于 2019-9-27 09:48:57

面板给的wp伪静态规则无法访问管理后台某些页面怎么改

使用的是宝塔win面板6.4版本,给网站设置了宝塔面板提供的默认伪静态规则保存后如下:
<?xml version="1.0" ?>
<rules>
        <rule name="category_rewrite">
                <match url="category/?(.*)"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                <action appendQueryString="false" logRewrittenUrl="false" type="Rewrite" url="/index.php?category_name={R:1}"/>
        </rule>
        <rule name="tags_rewrite">
                <match url="tag/?(.*)"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                <action type="Rewrite" url="index.php?tag={R:1}"/>
        </rule>
        <rule name="Main Rule_rewrite" stopProcessing="true">
                <match url=".*"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="index.php/{R:0}"/>
        </rule>
        <rule name="wordpress_rewrite" patternSyntax="Wildcard">
                <match url="*"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="index.php"/>
        </rule>
</rules>
经过测试有如下结论:1.用户访问前台页面伪静态没有问题。
2.管理后台比如访问分类目录设置、标签添加等页面的时候无法访问,会找不到页面。
3.删除上述伪静态内容后,分类目录设置、标签添加等页面可恢复访问,但用户前台访问文章页异常。

求解怎么修改web.config可以实现这些页面的正常访问呢?
因为用户权限原因无法发送url,所以我大概说一下网址是类似这样的:wp-admin/edit-tags.php?taxonomy=link_category

雪山凌狐 发表于 2020-2-11 17:56:08

宝塔用户_umihvr 发表于 2019-12-25 13:18
我也是这个问题,不知道如何解决

朋友,宝塔运维不管,我今天又再自己研究了一下,目前暂时解决了,你可以试试这个方法:
宝塔给的wordpress伪静态原文:
<?xml version="1.0" ?>
<rules>
        <rule name="category_rewrite">
                <match url="category/?(.*)"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                <action appendQueryString="false" logRewrittenUrl="false" type="Rewrite" url="/index.php?category_name={R:1}"/>
        </rule>
        <rule name="tags_rewrite">
                <match url="tag/?(.*)"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                <action type="Rewrite" url="index.php?tag={R:1}"/>
        </rule>
        <rule name="Main Rule_rewrite" stopProcessing="true">
                <match url=".*"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="index.php/{R:0}"/>
        </rule>
        <rule name="wordpress_rewrite" patternSyntax="Wildcard">
                <match url="*"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="index.php"/>
        </rule>
</rules>问题出在第二段上,你尝试删除这一段就能正常访问了:<rule name="tags_rewrite">
                <match url="tag/?(.*)"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                <action type="Rewrite" url="index.php?tag={R:1}"/>
        </rule>我想了下,猜测是匹配规则写的有问题,edit-tags.php这个路径也有tag会不会被错误匹配导致出问题我猜。因此我个人是修改成这样:
<rule name="tags_rewrite">
                <match url="/tag/?(.*)"/>
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                <action type="Rewrite" url="index.php?tag={R:1}"/>
        </rule>



经过测试,能够正常访问,前台的tag标签页也能正常访问。你试试看。


为此我写了一篇文章来说明,你也可以看一下。


可以到百度搜索“雪山凌狐教程”,搜索站内文章“宝塔面板给的wordpress伪静态规则启用后无法访问管理后台某些页面比如分类目录、标签等页面”即可看到。

雪山凌狐 发表于 2020-2-11 14:24:02

宝塔用户_umihvr 发表于 2019-12-25 13:18
我也是这个问题,不知道如何解决

对哇怎么办呢?宝塔的朋友也没有人回答这个的。。。

宝塔用户_umihvr 发表于 2019-12-25 13:18:28

我也是这个问题,不知道如何解决

雪山凌狐 发表于 2019-10-8 19:20:09

求回复,怎么没有人回复帮忙解答一下咩~
页: [1]
查看完整版本: 面板给的wp伪静态规则无法访问管理后台某些页面怎么改