I would like to remove index.php from my permalink.
I am using Codeigniter website.
I have passed the requirements to use pretty permalink:
-PHP Version 5.4.27 Codeigniter
-IIS 7.5
-URL Rewrite 2.0
-Server API: FAST CGI
Before, I have removed index.php from codeigniter. I wonder if wordpress webconfig file has conflicted with codeigniter. Some help on determining the right webconfig would be greatly appreciated!
website/en/user => codeigniter with the controller User
website/blog
/apps
/system
/blog
web config to remove CI index.php
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<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}" appendQueryString="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
/blog => WP app
web.config on WP dir
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<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>
</system.webServer>
</configuration>
The same question on stackoverflow:
I would like to remove index.php from my permalink.
I am using Codeigniter website.
I have passed the requirements to use pretty permalink:
-PHP Version 5.4.27 Codeigniter
-IIS 7.5
-URL Rewrite 2.0
-Server API: FAST CGI
Before, I have removed index.php from codeigniter. I wonder if wordpress webconfig file has conflicted with codeigniter. Some help on determining the right webconfig would be greatly appreciated!
website/en/user => codeigniter with the controller User
website/blog
/apps
/system
/blog
web config to remove CI index.php
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<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}" appendQueryString="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
/blog => WP app
web.config on WP dir
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<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>
</system.webServer>
</configuration>
The same question on stackoverflow:
https://stackoverflow/questions/29074588/wordpress-pretty-permalink-404-error-installed-on-iis-7-5
Share Improve this question edited May 23, 2017 at 12:40 CommunityBot 1 asked Mar 18, 2015 at 3:22 xyonmexyonme 1211 silver badge6 bronze badges 1- Similar Question stackoverflow/questions/25439087/… Solution stackoverflow/a/38524169/6614080 may work for those who are struggling. – Asif Thebepotra Commented Jun 8, 2020 at 20:45
2 Answers
Reset to default 2After struggling for a while in the web.config structure. I found out we need to clear the rule before to add another rule. Just add tag </clear>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear/>
<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>
</system.webServer>
</configuration>
Make web.config put in the root directory.
User code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<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}" appendQueryString="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>