6

In permalinks(dashboard) section index.php added. e.g.

Current Post Name: http://zakatchicago.com/index.php/sample-post/
Expected Post Name: http://zakatchicago.com/sample-post/

How can i remove index.php?

Note: I am using windows server

1
  • You could find an answer to this problem? I'm looking solving the same problem but I can't find an solution yet. Nov 3, 2016 at 0:15

2 Answers 2

0

According to the documentation here: http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress

I assume you have already selected Post Name in your permalink structure:

Then include this code in web.config

<rewrite>
<rules>
    <rule name="Main Rule" 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>
4
  • Already I putted in root web.config file containing above code .But not any change. May 20, 2015 at 11:41
  • I want to remove index.php from permalinks.Also from site url. May 20, 2015 at 11:44
  • stackoverflow.com/questions/12106064/… - you also need to set the permalink structure found in the accepted answer at this link. Feb 28, 2017 at 17:32
  • 1
    @DerreckDean Thanks, I think I have already mentioned it before the code.
    – m4n0
    Feb 28, 2017 at 18:32
0

As of WP 5.9 (but I am sure way back years and versions) there is no need to add web.config manually.

In case IIS rewrite module is installed (whichi is a prerequisite) when you modify Settings/Permalink, WP automatically emits web.config into the root of your site.

It even writes to the GUI a warning message, to revoke write access from web.config.

If IIS rewrite module is not installed, all of this above is not possible, neither manually, so WP will include the /index.php/ fragment in the path. If you overwrite this setting with a custom permalink setting, then the links will adopt (so will not contain the /index.php/ fragment, but because of lack of rewrite facility IIS will give 404.

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.