Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove index.php from wordpress URLs in iis7

I want to remove index.php from url , i am using wordpress and iis7 . how can i do this

like image 965
rash111 Avatar asked Aug 24 '12 08:08

rash111


1 Answers

Use this web.config

(web.config is the IIS equivalent to .htaccess file in apache webservers. It can be found in the root folder. If there is none, you need to create one.)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
 <defaultDocument>
     <!-- Set the default document -->
      <files>
        <remove value="index.php" />
        <add value="index.php" />
      </files>
    </defaultDocument>
        <httpErrors errorMode="Detailed"/>
    <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>

Then in permalinks page, set "Custom Structure" and give the value /%postname%/

Note that URL Rewrite module specific to IIS version needs to be installed for this to function(Thanks to @Spikolynn's comment below)

like image 137
Binod Kalathil Avatar answered Sep 29 '22 16:09

Binod Kalathil