.htaccess and WordPress 2.2

by Kristi on June 11, 2007



99.8% of you don’t know what I’m talking about so feel free to move on.

Go on now. Shooo!

Wow. I just spent three days on this freaking problem and it was the simplest fix.
I started up a new blog for a project I was thinking about starting.
Wrote up a custom .htaccess file for it. The really cool thing is that, with the help of some online forums, I figured out how to make each individual URL (non-www) rewrite to its sister URL (with the www) instead of 301’ing to the main domain! All my other blogs I have created with custom .htaccess files 301 all internal URLs to the main domain. Which is technically fine. But I like things to be just so. So I’m happy I figured that out.

Here is the initial .htaccess file that I used for previous blogs:

ReWrite Engine On
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com [R=301,L]

Here is the new one:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

The really sucky thing is that after I would create the .htaccess file, my whole blog would meltdown. After removing, reinstalling, and trying again (several times) – I finally realized this was some sort of WordPress template problem. After I would set a new template, WordPress would go back to normal. It made me really scared to fiddle with .htaccess – but now I don’t think I was doing anything wrong… I think I just had the wrong idea about what was going on.

What was even worse is that my new blog is using WordPress 2.2. When WordPress sets up, it uses the http://mydomain.com in the setup process (without the www). After I did the .htaccess thing, my editor that I use to write posts completely BROKE!

I honestly spent the last three days searching forums and asking questions trying to figure this out. I thought I screwed things up with the htaccess file, and I wiped my blog clean from the server – reinstalled again. It was horrible. I thought it was some javascripting error and I don’t know java script so I didn’t know how to fix it.

Well, I just found out today that the fix was SO easy. Since I did make all of my URLS 301 to www versions, the new WordPress 2.2 Visual Text Editor uses some type of Ajax and depends on your domain to work the editor.

The fix was that in Options, it asks you for the domain name of your blog. It set it up initially without the www. I added the www into the options section and now it works perfectly.

Whew.

I had to post this somewhere so I would remember it in the future. This blog may transfer to WordPress in the future (and I just realized WordPress has an import feature – so EASY!!!) and I wanted to make a note of it.

Comments on this entry are closed.

Previous post:

Next post: