Git Product home page Git Product logo

php-url-shortener's Introduction

Simple PHP URL shortener

Installation

  1. Download the source code as located within this repository, and upload it to your web server.
  2. Use database.sql to create the redirect table in a database of choice.
  3. Edit config.php and enter your database credentials.

Features

  • Redirect to Twitter when given a numerical slug, e.g. http://mths.be/8065633451249664http://twitter.com/mathias/status/8065633451249664.
  • Redirect to your Twitter account when @ is used as a slug, e.g. http://mths.be/@http://twitter.com/mathias.
  • Redirect to your Google Plus account when + is used as a slug, e.g. http://mths.be/+https://plus.google.com/u/0/116553353277057965424/posts.
  • Redirect to your main website when no slug is entered, e.g. http://mths.be/http://mathiasbynens.be/.
  • Redirect to a specific page on your main website when an unknown slug (not in the database) is used, e.g. http://mths.be/demo/jquery-sizehttp://mathiasbynens.be/demo/jquery-size.
  • Ignores weird trailing characters (!, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, @, :, ;, <, =, >, [, \, ], ^, _, {, |, }, ~) in slugs — useful when your short URL is run through a crappy link parser, e.g. http://mths.be/aaa) → same effect as visiting http://mths.be/aaa.
  • Generates short, easy-to-type URLs using only [a-z] characters.
  • Doesn’t create multiple short URLs when you try to shorten the same URL. In this case, the script will simply return the existing short URL for that long URL.
  • DRY, minimal code.
  • Correct, semantic use of the available HTTP status codes.
  • Can be used with Twitter for iPhone. Just go to SettingsServicesURL ShorteningCustom… and enter http://yourshortener.ext/shorten?url=%@.

Favelets / Bookmarklets

Prompt

javascript:(function(){var%20q=prompt('URL:');if(q){document.location='http://yourshortener.ext/shorten?url='+encodeURIComponent(q)}}());

Shorten this URL

javascript:(function(){document.location='http://yourshortener.ext/shorten?url='+encodeURIComponent(location.href)}());

Author

Contributors

php-url-shortener's People

Contributors

beverloo avatar mathiasbynens avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.