Tag Archives: IIS
Add www in-front of your domain using IIS
If you are using IIS you can use the snippet below in your web.config to add www. in-front of your domain if it is not already present.
Please keep in mind that to use the snippet below you will need to have URL Rewrite module installed and enabled.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Redirect to www" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^www\.<your domain>\.com$" negate="true" /> </conditions> <action type="Redirect" url="https://www.<your domain>.com/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration> |
Posted in Software Tips.
Force HTTPS using IIS
Google announced in their blog that it will start favoring websites that use HTTPS. Google ranking and increased security for your users is two major reasons why you should consider getting an SSL certificate and moving your website to HTTPS.
If you are using IIS you can use the below snippet in your web.config in order to redirect all HTTP requests to HTTPS.
For your convenience, in case you are not familiar how to use the snippet below, I have attached an image to illustrate how the rewrite rule will look using IIS’s interface, so if you are having trouble with the web.config, simply mirror the details in the image.
Please keep in mind that to use the snippet below you will need to have URL Rewrite module installed and enabled.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration> |
Posted in Software Tips.
Enable WordPress Permalinks On IIS
By default IIS will throw an error (usually a not found error, 404) when WordPress is using permalinks.
The reason of that is because IIS is trying to map the URL you are giving it to a file on the system, which obviously does not exist. Luckily there is a simple fix to this problem.
The logic behind this solution is simple. Check if the URL provided is pointing to a file or directory on the system. If not, rewrite the action to index.php which will allow WordPress to handle it.
In order to enable WordPress permalinks on IIS add the following rewrite rule in your web.config where your WordPress is located.
1 2 3 4 5 6 7 8 9 10 11 12 | <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> |
Posted in Software Tips.