Su.pr for WordPress

The Su.pr plugin for WordPress enables users to easily post links to Twitter and Facebook. It supports the following features:

  • Easily post to Twitter and Facebook when you publish your blog directly in WordPress.
  • Customize your post or one click post with your blog title.
  • Host short URLs on your own domain.
  • Search engine friendly short URLs (301 redirect).
  • Drive more traffic with the self-hosted StumbleUpon toolbar.

Installation

1. Download the plugin.
2. Put the “Su.pr” folder into your wp-content/plugins/ directory.
3. Go to the Plugins page in your WordPress Administration area and click ‘Activate’ for “Su.pr power.”
4. Go to the “Su.pr” options page (Options > Su.pr) to set your preferences.

Su.pr account and API key

You can sign up for an account at http://su.pr/. Your API key and account name can be found by going to Settings. Simply enter the API key and account name on your ‘su.pr’ options page in WordPress and you are ready to start posting to Twitter and Facebook.

Short URLs on your own domain

You can have short URLs on your very own domain (i.e. http://yoursite.com/asdf).
If you are hosting your blog at the root of your website (i.e., http://yoursite.com/) then follow the 3 steps below.

  • Step 1: WordPress Settings
    • Go to your ‘su.pr’ options page (Options > su.pr) in WordPress, select the option to host short URLs on your own domain and click “Save options.”
    • Go to your ‘Permalinks’ options page (Options > Permalinks) and select a permalink option other than the default (i.e. Day and name) and click ‘Save Changes’. Note: even if you have already selected an option other than default before, you will need to click ‘Save Changes’ again for the hosted short URLs to take effect.
  • Step 2: Sync your settings to Su.pr
    Go to http://su.pr/settings/ and enter your domain in the Promoted Websites section. Click “Save settings” and our servers will fetch your settings from WordPress. Verify that your setting is synced with Su.pr.
  • Step 3: You are ready to go!
    Try shortening a link to one of your blog post and you should have short URLs on your very own domain!

If you are hosting your blog in a sub-directory (i.e. http://yoursite.com/blog/) then please note this feature is in Beta. It is currently available only for servers running on PHP 5.

If you use WordPress, setting up short URLs on your own domain just got easier with the [[Su.pr Plugin for WordPress | Su.pr Plugin for WordPress]].

Step 1 – Setting up supr.php


  • Verify that your web server is running PHP 5 with libCurl installed.
  • Download the plugin.
  • Unzip and configure supr.php with your account information as shown in the example below. (You can find your account information by clicking on Settings.)
    $domain = “http://yourdomain.com/”;
    $login = “your_supr_username”;
    $apikey = “6b976e43234301b4b4be225180ebdd2bd”;
  • Set both search engine friendly redirects (301) and short URLs on your domain option to 1 in supr.php.
    $headers->is_301 = “1″;
    $headers->is_shorturl = “1″;
    You can verify the file is setup correctly by going to http://yourdomain.com/supr.php?check_install=1. You should see the following in the browser: {“version”:”1″,”is_301″:”1″,”is_shorturl”:”1″}
  • Upload supr.php to the root folder of your website.

Step 2 – Add the rewrite rules


You need to add a couple rewrite rules so short URLs for your domain can be handled by supr.php script. Please add these lines to your rewrite.conf or .htaccess (usually found in the root folder of your website). The rewrite rules first check to see if the requested web page exists on your website. If it doesn’t exist then it will redirect to the supr.php script if the requested page is in the 4 letter short URL format.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[a-zA-Z0-9]{4}$ supr.php?supr=$0
RewriteRule ^supr_settings.json$ supr.php?check_install=$0
</IfModule>

You can verify the rewrite rules are running properly by going to http://yourdomain.com/supr_settings.json. You should see the following in the browser:{“version”:”1″,”is_301″:”1″,”is_shorturl”:”1″}

Step 3 – Sync your settings to Su.pr


Simple visit http://su.pr/settings/ and enter your domain to the list of promoted websites. Click Save and your should see the updated settings for your domain. Once the features are enabled in your settings page, you are ready to go! Try and shorten a URL for web page on your website and you should have your very own short URL!

Step 4 – Get more traffic with the Su.pr bar


To receive more traffic from StumbleUpon, be sure to display the Supr bar when visitors click on a Su.pr short URL on your domain. The bar will only be displayed to visitors that click on a Su.pr link (it will not be displayed to visitors that come to your website from other sources).

Simply add the following link to your header portion of your web page (usually in a header template file):

<script src=”http://su.pr/hosted_js” type=”text/javascript”></script>