How to create a Google+ vanity URL

Posted by on Oct 8, 2011 in Miscellaneous, Tutorials | 0 comments

I’ve been looking at G+ recently, in particular the traction it’s gained amongst photographers. I felt like giving it a proper try for myself an early annoyance was the much talked about issue with profile URLs.

As you probably know, Google has (for now) decided not to go down the route of vanity URLs and instead use a numerical ID to identify users. So my G+ profile can be found at “https://plus.google.com/107139161496384775401/posts”. The drawback here is that it’s not practical to quote my G+ address to other people so their only option is to open the website and search for me. Now in practical terms that’s not too bad for me because my name isn’t so common but if you have a popular name it must make life very difficult.

My solution was to create a custom URL using my own domain. You can now find me at http://gplus.edjeavons.co.uk.

Step 1: Domain DNS

In my domain’s DNS settings I setup a new record for the “gplus” subdomain and pointed it towards my web server.

Note that some domain registrars may let you setup web forwarding directly in your domain’s setting but mine only does that for the “www” subdomain so I couldn’t do it there. Otherwise it would have been a one-step process.

Step 2: Web redirect

There are a number of ways you would do this, like adding a redirect within an Apache vhost, within a .htaccess file, or even within a PHP/HTML file. I chose to do it within the .htaccess file because it allows me to amend it in the future without messing with Apache’s config files again.

I didn’t think it was worth setting up a new vhost just to handle this special case so I added gplus.edjeavons.co.uk as a ServerAlias of this website.

ServerAlias gplus.edjeavons.co.uk

With that done I restarted Apache and opened up my website’s files, then in the .htaccess file I added the following two lines near the top:

RewriteCond %{http_host} gplus.edjeavons.co.uk [nc]
RewriteRule . https://plus.google.com/107139161496384775401/posts [r=301,L]

This basically tells the server so redirect visitors to my G+ page when it detects a request for gplus.edjeavons.co.uk.

One DNS entry and 3 lines of code … done!

Leave a Comment