Categories
All Posts Wordpress

You should update your web.config now WordPress Permalinks

Are you trying to use Permalinks with WordPress to have a nice page name rather than www.domain…com/?p=3 and you see the message toward the top of your page that says “You should update your web.config now”?

You might be thinking what is a web.config. This means that you are running your WordPress site on a windows server like Windows 2012R2 server and the WordPress Admin can not add the code to the web.config file which is on your server under the default install folder for WordPress.

First you need to locate your web.config file.

  • You should find it in the default root where you installed WordPress. This folder will also have the folders “wp-admin”, “wp-content” and “wp-includes”
  • You can search your server for the web.config file. Note you may have more than one. So make sure this folder has these folders “wp-admin”, “wp-content” and “wp-includes”.

If you can’t access your file system to locate this file then you can’t user permalinks. If you are hosting with godaddy you want to use a Linux server. If you are using a dedicated server you should be fine running WordPress on a Windows Server. I know of several successful sites.

Once you find your web.config file you want to open it. You can open it in WordPad or Visual Studio if you have it loaded.

You need to add the code shown below and you can add it just below the line.


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

Now Save your changes to the web.config file.

And now your web.config probably looks very much like the following.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<system.webServer>
		<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>
		<staticContent>
			<remove fileExtension=".svg" />
			<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
		</staticContent>
        <defaultDocument>
            <files>
                <remove value="index.aspx" />
                <add value="index.php" />
            </files>
        </defaultDocument>
	</system.webServer>
</configuration>

Credit for the code goes to Jeff Clark NOTE his code does not have the correct double quotes for the asp.net web.config file found