Godaddy URL Rewrite Fix for directory without trailing slash

Not too long ago, I upgraded my godaddy.com hosting account from the linux basic to windows deluxe plans. I did this because I have multiple domains I’d like to host with a single company. I’d never had issues with godaddy’s linux hosting.

The problem was that I am a .NET developer and I wanted to start hosting some ASP.NET applications. Since the windows plans are also capable of hosting WordPress, I decided to switch.

My first suggestion to you if you’re looking to switch from linux to windows with godaddy: don’t.

My second suggestion is that, when you have problems, you don’t contact godaddy customer service. After five emails or so, I’ve determined that the customer service is outsourced and the names in the signature of the email such as “Andrew P” or “Anna K” are fake.

I won’t go into it, though. I’ll just give you the fix.

Drop a web.config file into the root of your domain’s directory like so:

<?xml version="1.0"?>
<configuration>
   <system.webServer>
      <rewrite>
         <rules>
            <rule name="Host Directories Fix" stopProcessing="true">
		        <match url="^(.*)[^/]$" />
		        <conditions logicalGrouping="MatchAny">
		            <add input="{HTTP_HOST}" pattern="^ipreferjim\.com$" />
                 	<add input="{REQUEST_FILENAME}" matchType="IsDirectory" />
		         </conditions>
		        <action type="Redirect" url="http://www.ipreferjim.com/{R:0}/" redirectType="Permanent" />
		    </rule>
         </rules>         
      </rewrite>
   </system.webServer>
</configuration>

On the highlighted lines (9 and 12), you will have to replace my domain name with your own.

The reason this is necessary is because godaddy has IIS 7 configured improperly for serving directories. In fact, here’s the initial email I received from them:

Dear Jim,

Thank you for contacting Online Support.  
Upon review of your account it appears you have a Windows hosting account running IIS7.  
The issue you are seeing happens because of the way it is configured with our system.  
I apologize for any inconvenience.

Please let us know if we can assist you in any other way.

Sincerely,

Anna P.
Online Support Team

Related Articles