0

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.com/en/user => codeigniter with the controller User
website.com/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.com/questions/29074588/wordpress-pretty-permalink-404-error-installed-on-iis-7-5

1

2 Answers 2

2

After 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>
0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.