Using htaccess to create a subdomain on apache

by Mats Hellman on 20.Feb, 2008 under Linux

I’ve been thinking of starting a blog to keep my thoughts and ideas together in one place. To do this I wanted to use a simple subdomain to nixadmins.net like blog.nixadmins.net. To do this in a simple way without touching too much of the configuration I did it using the Apache’s .htaccess file.

The htaccess file can be used to many things, in this short short story I’ll only go in to creating a working subdomain. But you can find a lot more in the htaccess tutorial.

If you have a .htaccess file you can modify it, if not just create a new one in any editor.
Put the following lines in it, and of course change the values to suite your need.

<IfModule mod_rewrite.c>
RewriteEngine on
# Rewrite for Wordpress blog
RewriteCond %{HTTP_HOST} blog.nixadmins.net
RewriteCond %{REQUEST_URI} !blog/
RewriteRule ^(.*)$ blog/$1 [L]
</IfModule>

After that, create a DNS cname record, of blog.nixadmins.net that points to the same server, for me www.nixadmins.net. And you are done.

Leave a comment

When you begin your Linux experience.

by Mats Hellman on 08.Feb, 2008 under Linux

I remember the first year I tried Linux, I was so totally hyped about it. I started by trying out server software and pretty soon I was hooked on using it. It was great, I could run my own webserver, email server, SQL server and … and … and …, well you get the point I had to try everything. The best part was that everything ran on a 120MHz Cyrix with 64Mb RAM and 8Gb hard drive. It wasn’t fast but it did get me started.

Distro shopping

First I had to go trough a really huge bunch of distributions, my friends should agree that in the beginning an Linux installation had an average lifespan of 2 days on my desktop before I moved on to the next one. There were so many to try and I’ve always been a little of a operating system freak. After a while I realized that I had to get a place to store my settings and downloads centrally because every time I reinstalled I reformatted the drives. I know I could have saved /home but back then I didn’t really care, I had a new distribution and I just had to try it. This is when I got started with my first server.

Servers and hardware

So the first server was up and it ran nicely for quite some time. Then came the hardware shopping, I just had to get a lot of hardware I could run Linux on. This resulted in a bunch of REALLY old Mac’s lying around every corner, my girlfriend wondering if I lost it and my friends probably thinking, “Well that’s what you get from running Linux”. After I had installed Linux on almost every old Mac I got the hunger was still there, I had to try something else, so I got myself a Sun SPARCStation 5.

Sun SparcStation 5

It had 110Mhz microSPARC II processor, 128 Mb RAM, 1Gb hard drive, 21″ Sun monitor. As you might guess it wasn’t really a nice desktop but eventually I had it running Debian as a development and test server. It was a stable little server but it really lacked power of a modern computer, no wonder since it was released in the 1990’s.

Look where it got me

I sometimes wonder how much I’ve paid the electric company for my servers running 24/7 at home and how much I’ve put money in this process but I then quickly remind myself that any hobby costs money and it eventually pushed me into IT where I work now.

To the point

What inspired me to write this little post was this short video bellow that really reminds me of myself back in the early stages of my Linux experience. I hope you have as much fun watching it as I did.

3 comments

The #1 reason for programers / Gentoo users to be slacking of

by Mats Hellman on 07.Feb, 2008 under Linux, Programing

I found this xckd comic very funny. Being a Linux user and using Gentoo from time to time. I compile some programs and in Gentoo, you should know if you tried it, you compile almost everything.

Leave a comment