A professional PHP URL shortener with a secure admin dashboard and analytics. Built with Bootstrap 5 for a modern, responsive UI. Easily shorten URLs, track clicks, and manage statistics.
- Shorten URLs using
/r/shortcode
format - Admin dashboard with authentication
- Track clicks by date, IP, user-agent, and country
- Click analytics with chart visualization (Chart.js)
- Database-driven (MySQL) with clean structure (
app/
,api/
,public/
) - Optional QR code generation
- Responsive UI for desktop and mobile
-
Clone the repository:
git clone https://github.com/DigitalEforce/php-url-shortener-pro.git
-
Import the database via phpMyAdmin or MySQL CLI.
-
Configure database connection in
app/config.php
:$host = "localhost"; $dbname = "url_shortener"; $username = "root"; $password = "";
-
Optional:
.htaccess
for clean URLs:RewriteEngine On RewriteBase /php-url-shortener-pro/public/ RewriteRule ^r/([a-zA-Z0-9]+)$ redirect.php?c=$1 [L,QSA] RewriteRule ^$ index.php [L]
-
Access the project:
- Public:
http://localhost/php-url-shortener-pro/public/
- Admin:
http://localhost/php-url-shortener-pro/public/admin/login.php
- Public:
- Visit homepage.
- Enter the long URL.
- Click Shorten URL.
- Copy the generated short URL, e.g.,
http://localhost/php-url-shortener-pro/public/r/abc123
.
- Login URL:
http://localhost/php-url-shortener-pro/public/admin/login.php
- Username:
admin
- Password:
admin123
Admin Features:
- View all shortened URLs
- Track total clicks per URL
- Detailed analytics (Chart.js)
- Logout functionality
- View total clicks per URL
- Clicks over time chart
- IP, country, and user-agent per click
- Summary cards for Total URLs & Total Clicks
We welcome contributions!
- Fork the repository
- Clone your fork locally
- Create a branch:
git checkout -b feature-name
- Make changes
- Commit changes:
git commit -m "Add feature"
- Push branch:
git push origin feature-name
- Open a Pull Request
See CONTRIBUTING.md
for full guidelines.
I am Naveed, a passionate PHP developer. I specialize in creating modern, secure, and professional web applications using PHP, MySQL, and Bootstrap.
Check my GitHub for more projects: https://github.com/DigitalEforce
MIT License