Short URL Plugin
Adding a custom error page when redirect not found (1 post)

  1. mwkgeo
    Posted 4 years ago #

    I found this to be a very handy little plugin, which is simple enough to remain compatible with future versions of WordPress. It will mask link URLs as well as track clicks. Thanks Harley!

    (Note that if Short URL is installed through WP admin, you'll have to manually copy u.php from the plugin folder to the home folder if you want to use it from there.)

    Here's how I modified u.php to display a custom error page when a redirect is not found.

    Add the following line with the other variables - careful, modify accordingly...

    $not_found = "http://edit-to-add-your-domain.tld/custom-error-filename.html"; // The page to redirect to if no redirect link is found in the database - edit this line to reflect your domain and the filename of your error page

    Then substitute the following line...

    header("Location: $not_found");

    For these 2 lines...

    echo "<h2>Short URL Not Found</h2>";
    echo "<p>Sorry but the URL you entered was not found to redirect anywhere. Please check the link and try again</p>";


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Short URL Plugin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by mwkgeo
  • This topic is not a support question
  • WordPress version: 3.0.1