如何解决htacceess到web.config的wordpress和codeigniter
我在根文件夹上有codeigniter。然后在子文件夹(主页)上使用wordpress。以下是htaccess:
#RewriteCond %{HTTPS} =on
Options -Indexes
IndexIgnore *
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [PT,L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
RewriteRule ^$ home [L]
我已经制作了 web.config ,它删除了 index.php 用于codeigniter并在访问根域时重定向到wordpress(主文件夹)。但是在以下 web.config 中,我遇到了3个问题:
- wordpress永久链接不起作用。
- codeigniter仅在与 index.php 一起使用的网址时有效。
- 野生动物园总是显示
403 Forbidden. Access denied
。
web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true" >
<match url="^$" />
<action type="Rewrite" url="/home" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
PS:网站托管在Windows plesk(黑曜石)上
解决方法
尝试一下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 2" stopProcessing="true" patternSyntax="Wildcard">
<match url="*" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_URI}" matchType="Pattern" pattern="/home/*" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
<location path="home">
<system.webServer>
<rewrite>
<rules>
<remove name="home" />
<rule name="home" 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="home/index.php" redirectType="Found"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</location>
</configuration>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。