WordPress Development Asked by Jabel Márquez on November 6, 2021
I have a WP installation in its own folder (my-domain.com/site) and I’m trying that site works over my-domain.com. I’m not moving the installation files, actually I’m just giving to WP its own directory.
The WP installation is running over an IIS server. So I have a web.config file.
I’ve already done the steps that WordPress Codex says:
require( dirname( __FILE__ ) . '/site/wp-blog-header.php' );
According WP Codex for Permalinks without mod_rewrite, in the permalinks settings (in dashboard) I set to: /index.php/%postname%/
. If I remove the index.php
part from the permalinks settings doesn’t work anymore.
Right now my permalinks are working, but in this way: my-domain.com/index.php/page_example. I want to remove the “/index.php/” part from the url.
In my web.config I have:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<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>
I’ve tried even add a <clear/>
before add the rule but without success.
Note: If I left the site address (URL) with: my-domain.com/site and remove the “/index.php/” part from permalinks settings, the permalinks works good like this: my-domain.com/page_example.
Any idea how to solve this? Maybe I’m missing some rules in the web.config
Please try below in your web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{R:1}" pattern=".(gif|jpe?g|png)$" 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/{R:1}" />
</rule>
</rules>
</rewrite>
<security>
<requestFiltering allowDoubleEscaping="true" />
</security>
</system.webServer>
</configuration>
Answered by Pratik bhatt on November 6, 2021
There was something installed on the IIS server that was capable to read the .htaccess
files; and was ignoring the web.config
so the WP documentation with .htaccess
works for me.
Answered by Jabel Márquez on November 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP