Google+ is pretty cool and getting cooler by the day. Circles are a great tool to connect with the people you’ve just met, but right now it’s a bit tricky to share your profile URL since they look something like this: https://plus.google.com/102817283354809142195 (that’s my profile if you’re wondering)
A lot of us already have a short, witty personal domain name, and on these domains the /+ path is almost always available. Wouldn’t it be cool if we could just tell people to find us at http://example.com/+?
Now that we have the awesome idea, how do we implement it? This will differ a bit based on how your web site is set up and how much access you have there.
With Apache .htaccess and mod_rewrite
If you have access to write .htaccess files on your web host, this is a great solution. If you do not know what a .htaccess file is, skip to the next option :)
- Create a
.htaccess file in the root directory of your domain with the following contents:
RewriteEngine On
RewriteRule ^/?\+$ https://plus.google.com/NUMBER_PART_OF_YOUR_PROFILE [R=301,L]
On nginx
There are indeed web servers other than Apache. One popular alternative is the awesome nginx. I’ve never had the pleasure of using it, but luckily Chris Broadfoot was kind enough to share this nginx rewrite rule.
- Drop this configuration into your server’s configuration file.
server {
server_name yourdomain.com;
location ^/?\+$ {
rewrite ^ https://plus.google.com/NUMBER_PART_OF_YOUR_PROFILE permanent;
}
}
With JavaScript
What if you lack either SSH access or are not comfortable with mod_rewrite? All is not lost! If your website allows you to paste in some JavaScript code you can still set up a redirext. This method is not optimal, though, because it has a way of confusing web crawlers and primitive web browsers. In any case, here are instructions:
- Create directory
+ in the root of your domain.
- Add an
index.html in that directory with the following contents:
<!doctype html>
<html>
<head>
<script type="text/javascript">
window.location="https://plus.google.com/NUMBER_PART_OF_YOUR_PROFILE_URL";
</script>
</head>
<body></body>
</html>
If you’d like to see this implemented on any other platforms, give me a hollar and I’ll add it :)
Thanks to: