Freigeben über


Wordpress on IIS7.x : Permalinks, Media /wp-content/ access

One of the mechanisms of improving SEO on Wordpress driven sites is to switch to a more semantic URL scheme.

On an IIS7 installation, after selecting one of these permalink options, Wordpress then suggests you edit and/or create a web.config entry:

If your web.config file were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules> element in web.config file.

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

If you temporarily make your web.config file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.

If you are uploading your own media to Wordpress, I have found the following web.config works better:

 <rules> 
<rule name="Imported Rule 2" stopProcessing="true"> 
<match url="^(.*/)?wp-content/(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAny"> 
<add input="{URL}" pattern=".*wp-content/plugins.*" ignoreCase="false" negate="true" /> 
</conditions> 
<action type="None" /> 
</rule> <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>

Comments

  • Anonymous
    March 09, 2012
    K belgesi , Src Belgesi , Psikoteknik belgesi