How to fix URL problem on Windows hosting with Godaddy

Here is another tidbit that made me lose some sleep over the past few days. Well, not actually sleep, but a few good hours pulling my hairs and another hour on the phone with the Godaddy support. I have to admit that they are quite polite and nice to talk to.

My main problem appeared when I decided to move a WordPress blog to one of my Windows hosting accounts with Godaddy. Everything went well until I assigned a new domain name to the blog. Basically I had the blog in a folder which in turn was located in the root of my hosting account. So when getting the new domain name, which I was planning to use with this blog, I naturally pointed it to the blog folder.

What I didn’t expect was the WordPress login to stop working even though I previously made all the necessary configurations on the dashboard. When I entered the username and password and clicked LOGIN, all I was getting was the same login page without any error messages (no login failed or anything else).

Here’s what I’ve found and will detail a bit since many may experience parts of the problem, with the cause being the same. If you think you know what’s going on and only need the solution, please scroll down and pick up the code.

Once the login was not working I started looking at the URL. Surprisingly, when accessing the wp-admin URL of the blog, I was correctly redirected to the login page but the URL also contained a redirect_to variable that contained an invalid URL. The invalid URL looked something like “”, where hosting folder was the physical folder in which the blog resided on the disk and which should have been totally invisible since it contained the root of

No need to say that when removing the invalid part of the URL in that variable and trying to login, everything went well and I could get to the dashboard. Initially I thought that there may be some URL rewriting involved in the web.config file of the WordPress platform. I was correct in that there was some URL rewriting code present but I was 99% sure it did not have anything to do with my main problem. Just to be sure, I tried to creating an empty folder and simply access it ( Law and behold, the invalid URL ( showed up in the address bar, even if I got a 404 page. Just to make sure that the web.config was not somehow inherited by the empty folder I tried this on two other domains that didn’t have any web.config files nor any WordPress installations for that matter. Surely enough, same thing happened. It was obvious at this point that this was Godaddy territory.

I won’t go into much detail on the phone conversation but suffice it to say that they initially tried to blame it on WordPress and kick the ball in my court but when faced with the empty folder case on a different domain, the issue was escalated to the Godaddy elders on a higher branch of the tree. The final answer: Godaddy configures by default all URL requests that DO NOT end in a slash to be treated as a request to a file and there’s nothing they can change about that. If a folder exists with that name, well, bummer, you need to add that trailing slash otherwise strange things happen.
I’m not sure how and why accessing a non-existent file will result in the URL getting rewritten, maybe someone else can explain that, but now that I knew the source of the problem it was easy to write a simple URL Redirecting rule in the web.config file that took care of this. Here it is:

<rule name="Add trailing slash to directory requests">
    <match url="^(.*)[^/]$" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" />
    <action type="Redirect" url="{R:0}/" redirectType="Permanent" />

Make sure you replace “yourdomain” with your actual domain name.

That should do the trick. Hopefully this will save some people the trouble of going through the usual channels like forums and Godaddy support when faced with this issue.

Leave a Reply

Your email address will not be published.