Skip to content

Tag: IIS

WordPress – Time To First Byte Slow – IIS

I had a problem with a WordPress website that I recently moved to a new server running PHP 5.4 and IIS. I found that the fix to my problem was in the wp-config.php file. I had to change the hostname of the MySQL db from localhost to 127.0.0.1. Maybe this is an issue with IPv6 being enabled on the server. I’ll try and look at that later.

From…

/** MySQL hostname */
define('DB_HOST', 'localhost');

To…

/** MySQL hostname */
define('DB_HOST', '127.0.0.1');

 

Leave a Comment

Redirect to HTTPS – Using URL Rewrite

I needed to redirect a HTTP website to HTTPS. I thought it was part of IIS, and I think it was at some point. Maybe in IIS 7.0.

But here is the code to redirect to HTTPS. I grabbed it from here http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/.

You will also need to install the URL Rewrite module located here: http://www.iis.net/download/urlrewrite.

<rule name="Redirect to HTTPS" stopProcessing="true">  
  <match url="(.*)" />  
  <conditions>  
    <add input="{HTTPS}" pattern="^OFF$" />  
  </conditions>  
  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />  
</rule>
Leave a Comment