vvoody / cmprzurl Goto Github PK
View Code? Open in Web Editor NEWA simple implement of TinyURL.com and deploy easily on your own domain.
A simple implement of TinyURL.com and deploy easily on your own domain.
cmprzurl - a simple implement of TinyURL.com and deploy easily on your own domain. ============== Introduction: ============== Have you ever heard of tinyurl.com or is.gd? Do you wanna make your domain have the ability to shorten long url? Yes, all we need is 4 files. Maybe you should read the section 'What each file do?' first ;-) ============= Requirement: ============= * Apache web server and support .htaccess [2.0.63] * SQLite3 [3.2.1] * Python [2.3.5] * pysqlite2 (or sqlite3) module # My environment is what you see in the brackets. =========== Installation: =========== The following steps we are under root directory of your domain. e.g.: http://xxxxxx.org -> /home/xxxxxx/xxxxxx.org/ 0. Upload the files: cmprzurl.py, redirect.py, dotaccess, cmprzurl.sql, (cmprzurl.db) 1. Create a sqlite3 database and a table using the following directive: $ sqlite3 cmprzurl.db < cmprzurl.sql # You can also skip this step by using the db I had created named 'cmprzurl.db'. 2. Append the content of dotaccess into your .htaccess: $ cat dotaccess >> .htaccess 3. Make the two scripts executable: $ chmod +x cmprzurl.py redirect.py 4. Clean up & done: $ rm dotaccess cmprzurl.sql ==================== What each file do?: ==================== * cmprzurl.py Generate an alias like 'eJk8pA' for mapping the long url, then store the alias and longurl into database. * redirect.py Redirect the request url like 'http://xxxxxx.org/eJk8pA' to the real url. * dotaccess Make the files/dirs under domain root directory works well as before, but the alias like 'eJk8pA' can be redirected correctly. * cmprzurl.db Store the aliases and their mapping longurls. ======= Usage: ======= Type the url from browser address bar directly: http://xxxxxx.org/cmprzurl.py?longurl=http://www.faqs.org/rfcs/rfc3022.html Or, you can generate a html form like: <form method="post" action="http://xxxxxx.org/cmprzurl.py"> <input type="text" name="longurl"> <!-- must be 'longurl' or modify the source code --> <input type="submit" value="Shorten!"> </form> Then, 'cmprzurl.py' will generate an alias for the long url like: http://xxxxxx.org/a9Y7Hz ========= License: ========= Copyright 2009 vvoody <ydoovv{AT}gmail.com> All rights reserved. The programs are released under GNU General Public License version 3. For license details, checkout: http://www.gnu.org/copyleft/gpl.html Any problems please contact vvoody -> ydoovv_AT_gmail_DOT_com
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.