Social media triX: turn subdomains into profile URLs

Profil-Redirects mit SubdomainsA couple of social networks offer nice, human readable profile URLs, but most still don't. And since nobody is going to remember a link like http://www.facebook.com/profile.php?id=717807375, it's a good idea to use a redirect: this way, Facebook and other URLs are much easier to remember in an offline talk for example. If you're running your own site using your own domain, it's very easy to set up a subdomain which points to your profile. facebook.datadirt.net opens my fb-profile page – here's a quick checklist on how to do that.

This kind of redirection is suitable for all kinds of links which you want to shorten and/or make easier to remember. There are no disadvantages whatsoever, as we are going to use a permanent redirect: this means that Google will not index the subdomain and hence there's no duplicate content problem. I'm using my own Facebook URL as an example for the following instructions – caveat: Your server has to run Linux and the apache rewrite engine must be enabled.

  1. Add a new subdomain: the way you set up a new subdomain depends on your web hoster. Usually it's done via some administration interface. Basically, a subdomain points to a subdirectory of the domains root-directory. In this example I added the new subdomain “facebook.datadirt.net” using the directory www.datadirt.net/facebook/
  2. This directory is going to contain just one file which you have to edit now. The name of the file is .htaccess (that's an Apache standard naming convention) and it contains the instructions that point the user to the destination URL. It takes only one line using the following syntax

    Redirect permanent CURRENTDIRECTORY TARGET-URL

    In this example, the content of the .htaccess file is:

    Redirect permanent / http://www.facebook.com/profile.php?id=717807375

  3. There's no third step – you're done. Don't expect your new subdomain to work right away though: because of the way the DNS system works there might be a delay of up to 24 hours until the new subdomain works. But you can instantly test your setup by entering the absolute URL, in this case:
    https://www.datadirt.net/facebook/
  4. Multiple redirects: Of course you can set up multiple subdomains (on multiple servers) and have them all point to the same profile. I added another subdomain to my personal site which also points to my Facebook profile: facebook.pettauer.net

    How to edit your .htaccess file using Windows: If you're using Windows, there is no chance of naming a file .htaccess as Windows requires at least one character before the dot. So use a name like temp.htaccess, edit the file, upload it to your subdomain directory via ftp and then rename it to .htaccess on the server. Or you can use a command-line tool and edit the file via a terminal window.

2 comments
fdhr
fdhr

it's very usefull :!:

Alex- The Blog Traffic Guy
Alex- The Blog Traffic Guy

This is a very good idea for getting people to remember my facebook page and to show people some authority that I have a site too. That's cool and can be done simply. I haven't been good in generating traffic and buildoing community with facebook. But I'll learn more from your blog :grin: Thanks!