Tag Archives: wordpress

How to move WordPress without breaking web links

WordPress allows you to specify your blog url as, for example, www.ipreferjim.com/site. It also allows you to run the blog from the base of your domain, e.g. www.ipreferjim.com. For the longest time, I didn’t mess around with this because I didn’t see it as a big deal.

Not long ago, I upgraded linux hosting to Windows deluxe hosting at Godaddy.com. There were so many issues with WordPress under windows (see my previous post). On top of that, performance had never been exactly what I’d expect, and a lot of constraints were blocking me from being productive. So, I switched to hostgator.com.

The problem is that I have years of links to my site in the format:

http://www.ipreferjim.com/site/2011/06/godaddy-url-rewrite-fix-for-directory-without-trailing-slash/

and I now wanted it in the format:

http://www.ipreferjim.com/2011/06/godaddy-url-rewrite-fix-for-directory-without-trailing-slash/

I went about this by following WordPress’s guide to giving wordpress its own directory. This went well, then I had to update the .htaccess file to allow /site/wp-admin yet remove /site from all other links.

# BEGIN WordPress

RewriteEngine On
RewriteBase /site
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]

RewriteRule ^/site/wp-admin(.*)$ /site/wp-admin/$1 [L]

# END WordPress

Flattr this!

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

Flattr this!