These days, social media is an important part in spreading your website. Many people will have their profile on facebook, twitter, linkedin, youtube and so on. Usually, many of these people link directly to their profile on these domains. Today I will show you a technique I use to have all of your social site URLs reside on your domain.
For example, instead of
http://www.twitter.com/imkazu, I will have http://www.imkazu.com/twitter. If you noticed, the 2nd link redirects to my profile on twitter.
There are a few advantages to this approach.
- you don’t need to remember the exact URL format of your social networking site (you just need to remember imkazu.com/twitter, imkazu.com/facebook and so on)
- if you ever change your social network profile, you just need to change a single redirect URL, and the previous links you’ve posted will be redirected to the correct URL
- when you post your social link, you are actually promoting your site’s URL as well, which increases visibility and brand awareness
So how do you actually implement this redirection ? There are two ways to do this.
If you have mod_rewrite installed on your server, you can simply add the following line to your .htaccess file
| php | | copy code | | ? |
| 1 | RewriteEngine On |
| 2 | RewriteRule /twitter/ http://www.twitter.com/imkazu |
| 3 | RewriteRule /facebook/ http://www.facebook.com/imkazu |
| 4 |
This will then simply redirect
http://www.imkazu.com/twitter to http://www.twitter.com/imkazu
http://www.imkazu.com/facebook to http://www.facebook.com/imkazu
Another way you can do this, if you don’t have mod_rewrite on your server, is to create a folder on your domain’s root directory and name them twitter, facebook, and so on.
You can then put a index.php file within these folders and in this index.php file, add the following line of code.
| php | | copy code | | ? |
| 1 | <?php |
| 2 | header("location:http://www.twitter.com/imkazu");
|
| 3 | ?> |
| 4 |
This will achieve the same result as the mod_rewrite redirect. As you can see, this doesn’t have to stop at twitter and facebook. You can create similar links for your linked in, yahoo, digg, reddit, myspace accounts and so on.
To success,
October 8th, 2010
kazu
Posted in
Tags: 














