- Site-visitor (V) enters any original URL to the Input field, like http://anydomain/any/path/etc;
- V clicks submit button;
- Page makes AJAX-request;
- Short URL appears in Span element, like http://yourdomain/abCdE (don't use any external APIs as goo.gl etc.);
- V can copy short URL and repeat process with another link
- Pure Nginx or Apache with mod_rewrite
- PHP 5.4+
- MySQL 5.6+ or PostgreSQL 9.2+
- Redis if you want use cache
- PHP extensions:
- pdo_mysql or pdo_pgsql
- Redis extension if you want use cache
- To make sure that you have installed all add-ons, run the following command
$ php -m | grep -e pdo -e redis
pdo_mysql
pdo_pgsql
pdo_sqlite
redis
You should configure one web-server Nginx or Apache
- Run php-fpm on 9000 port
- Insert into you nginx.conf server section from configuration/nginx.conf
- Change listen to you port
- Change root to you directory as root of project
- Create new Virtual host(separate domain or another port)
- Set root directory as root of project
- Change AllowOverride directive of you apache httpd.conf to All(needs for .htaccess file)
You should configure one database MySQL or PostgreSQL
- Specify host/user/password/database in config.ini file at database section
- Specify db as mysql or pgsql in config.ini file at database section
- Create relation under specified database from configuration/database.sql
- If you want use cache - enable it in config.ini file and specify hostport of Redis. Cache store shortUrl <-> longUrl as Redis strings
- Error handling must be implemented using logger into file, but not it show error message into output for development purpose
- Url validator
The content of this project itself is licensed under the Creative Commons Attribution 3.0 license license, and the underlying source code used to format and display that content is licensed under the MIT license.