简体   繁体   中英

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.

I'm running Windows 10, with IIS - and have installed PHPv7.3

I have setup my hosts file to point to my local IIS webserver:

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:

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:

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.

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?

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):

<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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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