Moving hosts and htaccess rewrite rules

I’ve been at this since waking up this morning! I’m currently paying for two hosts, my older reseller account and a newer Grid-Service account with Media Temple, where W.nu is hosted. I’ve been doing this for quite a couple of months now, mostly because I’d been a bit too lazy to actually move my sites over; and my, it’s quite a handful.

A chunk of the “trouble” is that Media Temple has a specific file structure and control panel and whatnot. Don’t get me wrong, it’s organized and I love it, but it makes transferring stuff over a little more difficult. Transferring Seasonal Plume was easy (what an understatement), but Aking Mahal is another matter; I’m still at it.

The biggest “problem point” is that AM.net has a lot of subdomains. That meant a lot of things: cluttering up my MT control panel with subdomains, more than half of which are just pointers to new sites or a note that the fanlisting is closed; and each subdomain has a different placement than my older host which meant just dumping a backup wasn’t going to work, too. It means uploading things manually. Err. For three of my shrines I have screencaps. Lots of files, images, jpegs. Ouch.

And since I don’t care about clutter, that also meant that I needed to automatically point a nonexistent subdomain to a particular file that says “closed” or some such. I am a dunce with htaccess, which meant I spent most of last night and a good part of this morning researching on how to do this. I was able to do it finally though! Huzzah!

I present to you an htaccess rewrite rule to redirect particular subdomains to a certain file on the main website (needs to have wildcard subdomains working):

### Rewrite rules for closed fanlistings
RewriteEngine On
RewriteBase /
RewriteCond $1 !^gone
RewriteCond %{HTTP_HOST} ^(some|list|of|closed|subdomains)\.aking-mahal\.net
RewriteRule ^(.*)$ http://aking-mahal.net/gone.html [L]

Squee! It can be a bit manual (needing to put subdomains that are closed in the list) but this looks good, at least for now. And I found it out all by myself, so I feel pretty proud. ^_^ I still need to read up a couple more for another project, but I’m pleased enough that I got this far.

I should have AM.net moved over completely by end of today, with a new cleaner filesystem, ready for a revamp (when I get around to it, that is). Indisguise is another matter, though :( The biggest things I will have to move is my homegrown downloads script/repository (which also means all AM.net downloads will be broken until I get it back up), as well as various sites there, likeĀ Indiscripts, my wallpaper archive (which is in dire need of a revamp too), my LJ toys mini-site, and various other odds and ends. It’s quite daunting, but needs to be done, both to free up some money per quarter but also because I’m not too pleased with my older host these days.

2 comments

  • Argh, moving hosts can be a pain in the butt if your host can’t migrate for you (panel to panel), which is a butt pain I know all too well. I went through something similar (though, not nearly so ingeniously fixed) last year when I was helping a friend move her fanlisting collective and I believe I cursed up a storm, lol.

    Yay for htaccess rewrite rule, though! How you figured that out I do not know.

    • A lot of research and trial and error on a domain I haven’t put out publicly yet XD Hee!

      I finally have it all behind me. Whew!

«