A clean, modern URL shortener with IP logging capabilities, custom aliases, and detailed analytics. Built with PHP and MySQL.
๐ Live Demo: https://short-u.free.nf
Clean, minimalist interface for URL shortening
Manage and track all your shortened URLs
Detailed IP logging and visitor analytics
- Custom Aliases: Create memorable short links with custom aliases
- IP Logging: Track visitor analytics including location, device, browser, and OS
- User Accounts: Register and manage your shortened URLs
- Clean UI: Minimalist, newspaper-inspired design
- Fast Redirects: Optimized for minimal latency
- Analytics Dashboard: View detailed statistics for your links
- Emoji Support: Use emojis in custom aliases
- Mobile Responsive: Works seamlessly on all devices
- PHP 7.4 or higher
- MySQL 5.7+ or MariaDB 10.2+
- Apache with mod_rewrite enabled
- PDO PHP Extension
git clone https://github.com/uzairdeveloper223/ShortU.git
cd ShortUCreate a MySQL database and import the schema:
mysql -u your_username -pCREATE DATABASE shortu CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
exit;Import the database schema:
mysql -u your_username -p shortu < htdocs/db.sqlCopy the example configuration file:
cd htdocs
cp config.example.php config.phpEdit config.php and update with your settings:
define('DB_HOST', 'localhost');
define('DB_NAME', 'shortu');
define('DB_USER', 'your_db_user');
define('DB_PASS', 'your_db_password');
define('SITE_URL', 'https://yourdomain.com');Ensure proper permissions:
chmod 644 config.php
chmod 755 htdocs/Ensure .htaccess is enabled and mod_rewrite is active:
sudo a2enmod rewrite
sudo systemctl restart apache2Your Apache virtual host should allow .htaccess overrides:
<Directory /var/www/html/shortu/htdocs>
AllowOverride All
</Directory>Navigate to your domain in a browser:
https://yourdomain.com
- Enter a URL in the input field
- (Optional) Add a custom alias
- (Optional) Enable IP Logger for analytics
- Click "Shorten Link"
- Register an account or login
- Navigate to the Dashboard
- View click statistics and IP logs for your links
POST /api/shorten.php
Content-Type: application/json
{
"url": "https://example.com",
"alias": "custom-alias",
"is_logger": true
}GET /api/validate-alias.php?alias=custom-aliasEdit config.php to customize:
DEFAULT_CODE_LENGTH: Length of auto-generated short codes (default: 6)MAX_CUSTOM_CODE_LENGTH: Maximum length for custom aliases (default: 50)SESSION_LIFETIME: Session duration in seconds (default: 7 days)HASH_COST: bcrypt cost factor for password hashing (default: 12)
- Passwords are hashed using bcrypt
- CSRF protection on forms
- Prepared statements prevent SQL injection
- Input validation and sanitization
- Session security with custom session names
For development, enable error reporting in config.php:
error_reporting(E_ALL);
ini_set('display_errors', 1);Remember to disable this in production!
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Design inspired by minimalist newspaper layouts
- Uses Tailwind CSS for styling
- Fonts: Playfair Display, Source Serif 4, JetBrains Mono
๐ Live Demo: short-u.free.nf
If you encounter any issues or have questions, please open an issue on GitHub.
Uzair Mughal
- GitHub: @uzairdeveloper223
- Website: uzair.is-a.dev
- Email: contact@uzair.is-a.dev
https://github.com/uzairdeveloper223/ShortU
- QR code generation for short links
- Link expiration dates
- Password-protected links
- API key authentication
- Export analytics data
- Custom domains support
- Link preview before redirect
Made with โค๏ธ for the open source community