There. I beat my deadline. The main site is live again! Yay!
But that is not to say that I got this without glitches. Let’s see…
After feeling good with the WordPress site I developed locally, I pushed it live by uploading all my local files (and changing password-related configs) to my server. However, I noticed that all my links start with “localhost”—they are pointing to the local version I developed. The only page I can view from my remote site was the home page.
The fix is easy enough. I just had to change all option values in the wp_options table of my WP site so that they don’t refer to localhost. To that end I ran the following query in my database:
UPDATE wp_options SET option_value = REPLACE(option_value, 'localhost/', ''); |
Note: be careful when running queries like this. The pattern matching went fine for me but some future version might use the term ‘localhost’ for something else. Always back-up before running! Also, you could’ve set this option up in your WP Admin. Just go to Settings -> General and change the URL-related settings. I wasn’t able to do it in this case because even the WP Admin was getting redirected to localhost!
So, after running that, I got my links good. However, clicking on the links returned a status 500 error (Internal Server Error)!
Googling around, it seems that this has something to do with my .htaccess . The .htaccess is a config file for web servers famous for allowing URL rewriting. It’s the magic behind http://skytreader.net/journal/post-title
instead of http://skytreader.net/journal/post-title.php
. You can also do cool (or sick, depending on your tastes) things with it like having pages with a .exe extensions (or pointing unsuspecting users to a normal .html page but is actually a sketchy .exe download). Here’s one tutorial I’m quite fond of.
Anyway, my .htaccess looked like, this:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /skytreader.net/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /skytreader.net/index.php [L] </IfModule> |
Now, I had no idea what to do with my .htaccess to prevent the status 500 from happening. Thank goodness that kodeplay itself is WordPress-powered. So, I just patterned it from kodeplay’s .htaccess:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> |
Aaaaannnd voila! Main site up and running! (Though, I won’t be surprised if there are still bugs with my launch.)
It seems that WordPress has a tutorial for migrating WP set-ups. Guess I should’ve read that first no?
Now, a TODO: Write a new entry on my main blog. The most recent one is now more than a year old!