我在microsoft窗口服务器6.2 IIS服务8.5上安装了cakephp 2.6版本,我在app目录下的子目录下安装了wordpress blog
|_ cakePHP
| |_ app
| |_ blog
| |_ lib
| |_plugins
如果我们点击baseurl / blog / index页面正确出现,那么在cakephp应用程序中正常工作的每一件事也会正常工作。
但是,当我们更改wordpress博客parmalink设置中的设置并制作像https://www.baseurl.com/blog/hello-world/这样的prety url时,它会给出404错误,但它使用像https://www.baseurl.com/blog/?p=1这样的普通网址
但我需要像qazxsw poi这样漂亮的永久链接网址
我搜索很多文章也发现很多,但没有答案正在使用带有cakephp的窗口服务器,因为你们都知道.htacces不适用于iis 8所以我在cakephp的根文件夹中创建web.config文件
https://www.baseurl.com/blog/hello-world/
根文件夹/ web.config以上的代码是
|_ cakePHP
| |_ app
| |_ blog
| |_ lib
| |_plugins
| |_web.config
和web.config放在博客目录的根文件夹中,所有wordpress文件都在下面
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!--# Exclude requests already going to /subfolder to avoid an infinite loop-->
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^blog.*$" />
<action type="None" />
</rule>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
<rule name="Exclude direct access to app/webroot/*" stopProcessing="true">
<match url="^app/webroot/c$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="Rewrite routed access to assets(geet_jewellery,img, css, files, js, favicon)" stopProcessing="true">
<match url="^(blog|buyanddelight|crm_geet|geet_jewellery1|geet_jewellery|img|css|files|js|favicon.ico)(.*)$" />
<action type="Rewrite" url="app/webroot/{R:1}{R:2}" appendQueryString="false" />
</rule>
<rule name="Rewrite requested file/folder to index.php" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Custom" defaultPath="C:\Inetpub\wwwroot\Indexhome_.htm">
<error statusCode="403" subStatusCode="4" path="C:\Inetpub\wwwroot\Indexhome_.htm" responseMode="File" />
</httpErrors>
</system.webServer>
</configuration>
我找到了很多答案,但都是不完整的,因为其中一些没有cakephp,其中一些没有wordpress,其中一些没有IIS服务器休息没有工作,所以请帮助我从这里。希望得到完整的答复谢谢
你也可以参考下面的链接澄清我的问题,因为它可以通过.htaccess实现,但我无法找到iis服务器web.config的答案
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress: https://www.buyanddelight.com/blog" 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>
</rules>
</rewrite>
</system.webServer>
</configuration>
enter link description here