Skip to content

Instantly share code, notes, and snippets.

@johndyer
Created July 13, 2011 13:06
Show Gist options
  • Save johndyer/1080261 to your computer and use it in GitHub Desktop.
Save johndyer/1080261 to your computer and use it in GitHub Desktop.
Google+ redirect .htaccess
#simple version (http://mysite.com/+ goes to your Google+ account)
Redirect /+ https://plus.google.com/[yourid]
Redirect /@ https://twitter.com/[twitterusername]
#powerhouse (http://mysite.com/+/about goes to your Google+ about page)
RedirectMatch ^/\+(.*)$ http://plus.google.com/[yourid]$1
RedirectMatch ^/@(.*)$ http://twitter.com/[twitterusername]$1
@tesserwithpaul
Copy link

must not be enough of a nerd. :) can you explain how to create a .htaccess file (when I download it to my macbook it is a zipped file with nothing in it) and then how/where to upload it back?

@johndyer
Copy link
Author

You can open up TextEdit (http://support.apple.com/kb/TA20406), enter the code above and then save it as ".htaccess". Once you've done that, you can upload it to the root of your site.

@tesserwithpaul
Copy link

and what is the root of my google+ profile? or how to i upload the htaccess to it? cheers!

@traeblain
Copy link

I've used this redirect to allow for additional redirects:

RedirectMatch ^/\+(.*)$ http://plus.google.com/[yourid]$1
RedirectMatch ^/@(.*)$ http://twitter.com/[twitterusername]$1

This allows for links to G+ /about, /photos, etc to work and for Twitter's /followers and /[AnyList] to be added to your new link and still redirect properly.

@johndyer
Copy link
Author

@tesserwithpaul, it doesn't go on google+. It goes on yourwebsite.com

@traeblain, nice work! I've updated the code...

@traeblain
Copy link

@tesserwithpaul You cannot upload an .htaccess file to Tumblr. But you can setup a redirect that will work like John's simple suggestion. What you need to do is go to your Tumblr dashboard and select 'Customize appearance' on the right. On the menu across the top you'll see Pages, click that then select 'Add a page'. In the popup, make the Page URL say:

pbwistanbul.tubmlr.com/+

On Page Type select 'Redirect', then in the Redirect to type:

http://plus.google.com/[yourid]

where [yourid] is your G+ id

Keep the 'Show a link to this page' unchecked then select 'Create page'. You'll most likely get an error, just close that window and hit 'Save + Close" on the main page. You should now have a like from http://pbwistanbul.tumlr.com/+ to your G+ account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment