Tuesday, June 25, 2013

Website Building Tutorials

I have been making websites for many years now and helped lots of people get started with their own websites and blogs.

People with less knowledge about web stuff tend to believe that building website is a very difficult job. Believe me now it has become a child’s play if you know about the right tools.

I own this domain websiteown.com for quite a while. I thought I should start a blog about building websites and blog on it.

If you are interested you can follow it.

I have already written a post regarding how to build a website for free.

Tuesday, June 11, 2013

How to add swap to amazon ec2

Like me if you are using amazon free tier to host your websites then you must have learnt that hosting any decent traffic website on the amount of RAM ec2 micro provides is very risky. specially mysql keep on eating the RAM. I use amazon RDS it also comes  under amazon free tier. But if you like to keep you mysql instance on your ec2 instance than you can add some swap space to it.

Here is  how to add swap space to amazon ec2 instance in step by step guide.

You need to be root to perform these commands. To do this issue this command

$ sudo su

Type the following command with count being equal to the desired block size:

dd if=/dev/zero of=/swapfile bs=1M count=1024

Setup the swap file with the command:

mkswap /swapfile

To enable the swap file immediately but not automatically at boot time:

swapon /swapfile

To enable it at the boot time, add the following entry into /etc/fstab:

/swapfile swap swap defaults 0 0

 

Remember last line is not a command. You have to add this line to the file /etc/fstab.

You can do this by

nano /etc/fstab

then paste above line right clicking.

hit control+x

type ‘y’

hit enter.

Tuesday, June 4, 2013

Redirect directory to root .htaccess

Simple of the things sometimes waste too much time. Recently I needed this simple htaccess script to direct one of the subdirectory to the root. I needed same url other than the directory part.

This htaccess code did it for me

RewriteEngine On
RewriteBase /
# redirect stores to root
RewriteRule ^stores/(.*)$ /$1 [R=301,NC,L]

This code redirected all the content of the stores directory to root directory.

I placed this code in the root htaccess and removed the htaccess file from stores directory.