This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

Introduction:

This how-to can be applied to any situation where you might need a permanent external redirect (301) from any page within the site. I am writing this specifically for a redirect to google+ business page.

Motivation:

As many of us are probably aware, google offers a custom url for a google+ page, but really, it's not very custom. The provide a base url to which you can append whatever you want. The base name isn't always the most desirable thing to use. Let me explain my situation.

I recently created a google plus page for my community site. I then created a site link from the plus page back to my site and verified it in order to use the custom url feature. When I attempted to create the custom url, they suggested the first half and allowed me to append something to it. Their suggestion was +MyHobbyOrg when I wanted it to be +MyHobby so I could append Community. I couldn't select another root. If I chose to accept it, I would be stuck with it forever. My hobby community is not called my hobby org community. The worst part is that giving out this name does wonders for google's branding and marketing, but does nothing for my own.

It has been suggested that if you want to hand out addresses to your google+ page, redirect to it from your own domain and share that custom url instead of google's. This grants full control over the custom url and actually helps your brand. You can also control redirects if you change your business domain name.

Do It Live!

Here are the steps to accomplish this in Concrete5.

  • In your dashboard, create a new single static page called "plus" (or g+ or foobar) and create an empty file "plus.php" in your site's single_pages directory.
  • Next, create a new page attribute with the handle "redirect_url" and name it "Redirect Url."
  • Navigate to your page attributes [dashboard -> sitemap -> page search -> properties -> custom attributes] and search for "redirect," set it to your site's google+ page url.
  • You should probably check the Exclude attributes as well to prevent it from showing up on your menu or in search.
  • Finally, add the following code snippet (found in another post) to the top of your theme's header file (I use a header.php which includes global areas, javascripts, css, et cetera)

Code:

if ($redirectURL = $c->getCollectionAttributeValue('redirect_url')) {
   if ($redirectURL != '') {
      Header( "HTTP/1.1 301 Moved Permanently" );
      Header( "Location: " . $redirectURL );
   }
}

That's it. Now browse to the new page url: yoursite.com/plus/ and you will be redirected to your google plus page.

Original blog post discussing the use of your domain instead of google+ custom urls.

http://localu.org/blog/alternative-google-plus-custom-urls/

Loading Conversation