简体   繁体   English

IIS 上带有 Woocommerce 的 Wordpress 未将 URL 解析为正确的映射

[英]Wordpress with Woocommerce on IIS is not resolving the URL to the correct mapping

I have installed Wordpress on my local machine - to test a few Woocommerce sites.我在本地机器上安装了 Wordpress - 测试一些 Woocommerce 网站。

I'm running Windows 10, with IIS - and have installed PHPv7.3我正在运行带有 IIS 的 Windows 10 - 并且已经安装了 PHPv7.3

I have setup my hosts file to point to my local IIS webserver:我已将我的主机文件设置为指向我的本地 IIS 网络服务器:

127.0.0.1       localwwl.co.uk

The home page of Wordpress comes up, and I can navigate into the control panel etc - but when I visit my local woocommerce site, and click on a product, I get a 404 not found error: Wordpress 的主页出现了,我可以导航到控制面板等 - 但是当我访问我本地的 woocommerce 站点并单击产品时,我收到 404 not found 错误:

Requested URL      http://localwwl.co.uk:80/product/
Physical Path      C:\inetpub\wwwroot\localwwl\product\

Similarly, if I visit the store (which has a "shop" added to the url) I get the same 404 error:同样,如果我访问商店(网址中添加了“商店”),我会收到相同的 404 错误:

Requested URL      http://localwwl.co.uk:80/shop
Physical Path      C:\inetpub\wwwroot\localwwl\shop

I know the physical file paths don't exist, but WordPress should be taking the URLs and retrieving the required info from the database.我知道物理文件路径不存在,但 WordPress 应该获取 URL 并从数据库中检索所需的信息。

Is there something within WordPress or IIS, that I need to set, to make sure that the requested URL maps properly to the right area on the local drive, and under wordpress's control?我需要设置 WordPress 或 IIS 中的某些内容,以确保请求的 URL 正确映射到本地驱动器上的正确区域,并在 wordpress 的控制下?

The Permalinks are setup exactly as they are on my live site - and I'm using a local copy of the live database.永久链接的设置与我的实时站点上的完全一样 - 我使用的是实时数据库的本地副本。

Thanks for any help,谢谢你的帮助,

Mark标记

For anyone else with this issue - I found an answer.对于有此问题的其他人 - 我找到了答案。

The following needs to be added to your web.config file (like .htaccess, but for Windows):以下需要添加到您的 web.config 文件(如 .htaccess,但适用于 Windows):

<rules>
<rule name="wordpress" 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>

Thanks for the other suggestions and comments.感谢其他建议和意见。

Mark标记

  • 请进入后端设置>固定链接并仅按保存更改按钮,我认为之后它会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM