Log in



Redirect a Sub Domain: e.g. twitter.yourdomain.com to Your Twitter Page

Tuesday, April 13th, 2010 by admin

We have recently setup our sub domain http://twitter.morditech.com to go directly to our twitter page at http://twitter.com/morditech. There are many reasons you may or may not want to do this but we chose to do it becuase it is easier to tell people how to reach us on twitter if they are already familiar with our website. it also gives us the ability later on to change the URL that http://twitter.morditech.com just in case we stop using twitter and want to redirect the traffic elsewhere.

This is how we did it in Plesk. In order for you to do this you will need the ability to create a sub domain, and use a .htaccess file.

  1. Create a sub domain. Any name that makes sense will do. We chose ‘twitter’. You may want to choose ‘follow’ or ‘facebook’ or whatever makes sense to you.
  2. Create a file named .htaccess with the following directives and then upload it to the web root of your subdomain. BE CAREFUL TO MAKE SURE YOU DO NOT OVERWRITE AN EXISTING .htaccess FILE IF IT IS ALREADY THERE. If there is already a .htaccess file in the web root of your sub domain then you will want to append the following directies to it.
    • RewriteEngine on
      RewriteCond %{HTTP_HOST} ^twitter.morditech\.com$ [NC]
      RewriteRule ^(.*)$ http://twitter.com/morditech$1 [R=301,L]
  3. You will have to replace the appropriate information above with your information
  4. Upload the file to your sub domain web root and test it. Make sure to test that your main domain name was not affected by this change and be careful that you uploaded the new .htaccess file to your sub domain web root and not your main domain’s web root.

Good luck, have fun.

Comments are closed.