Posted on Leave a comment

Pretty Permalinks in ASP.NET WordPress Hosting




This is how to remove “index.php” from your permalinks in ASP.NET Windows WordPress hosting. If you’ve installed WordPress on Windows ASP.NET hosting, you probably have found that there are a few minor differences. One of those differences is permalinks. Because PHP isn’t a standard language for ASP.NET hosting, you need to add a rewrite to your web.config file in the root of your site.

permalinks_aspIf you’ve already added index.php to the default file names of your Windows hosting, you’re close. If you go to your Settings > Permalinks in WordPress, you’ll notice that “index.php” is displayed on all options. If you do a custom permalink without it, your site will not work. What you need to do is add a rewrite rule to your web.config file. This is comprable to a .htaccess file on Linux hosting.

Add the following line of code immediately after <system.webserver>:

<rewrite>
<rules>
<rule name=”SEO Permalink” 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>

After you add that line of code, you can now remove the “index.php” part from your permalink structure and WordPress should function as normal.

Leave a Reply

Your email address will not be published. Required fields are marked *