We frequently encounter abbreviated URLs and even utilize URL shortening tools like tinyurl.com and bit.ly. Although these services are excellent, have you considered developing anything like to your own?
that’s rather simple to set up such a service on your own, and I’ll demonstrate how to accomplish that in this piece.
Enter Your Own URL Shortener, often known as YOURLS.
You may make your own customized domain URL shortener, similar to Tiny URL and Bit.ly, using this free PHP software.
Here are some reasons why we love it after installing and experimenting with it for a while:
- Simple to setup – If you have no trouble installing WordPress, setting up YOURLS will be a breeze.
- URLs that can be customized – Rather of using meaningless URLs like https://short.domain/3YghJ6zF, you may customize the links (for instance, https://short.domain/custom_name).
- You may monitor and keep track of information like the date of creation, IP address, clicks, etc. on the statistics admin page.
- Public/private links: You decide whether this service is accessible to the general public or only to you.
- To quickly build your own short URL, use the bookmarklet.
WordPress plugin and a developer API are both included with YOURLS. Please continue reading if you enjoy the thought of running a private URL-shortening service.
Here is an easy setup tutorial for YOURLS without further ado.
Getting going
Before the installation, you’ll need the following:
1. Domain
The ideal one would be very brief, but they are difficult to come by these days. If you’re considering registering an extremely short domain name, we advise you to try your luck with top-level domains ending in country codes like.at,.lv,.ly, etc.
2. A web hosting account that supports PHP
Because PHP is the language used by YOURLS, you must ensure that the server (dedicated or shared hosting) can run PHP 7.4 and MySQL 5 or later with mod rewrite enabled.
Learn more about the YOURLS specifications.
Developing a personalized URL shortening service
Now that we have everything we need, let’s use YOURLS to create our own URL shortening service.
Developing a personalized URL shortening service
Now that we have everything we need, let’s use YOURLS to create our own URL shortening service.
- Obtain a copy of YOURLS’ most recent release. We’re going to conduct some settings, so unzip it and open your preferred text editor.
- In your preferred code editor, locate includes/config-sample.php, rename it to includes/config.php, and then open it.
- You must modify the following settings: YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, and YOURLS_SITE. Change your username and username2 passwords, and that’s all. The remaining options are optional. The full document should be read; it is quite self-explanatory. If you’re not sure what to alter or how to make it, see the YOURLS setup guide.
- With the name YOU’VE INSERT FOR YOURLS_DB_NAME, CREATE A DATABASE. If you have access to cPanel through your web hosting account, log in and choose “MySQL Database” from the Databases column.
- Towards the root directory of your web hosting account, upload all files and folders with the same organization. Your root folder’s name might be anything from www t
- Open a browser window, then type “/admin/install.php” (without the quotations) after your domain name. An illustration is http://yoursite.com/admin/install.php.
- The link to your admin page will appear at the end of the following messages if everything is configured properly.
- By logging in, you may create your very own short URL. Make sure you select “Tools” to begin creating bookmarklets. Below is an illustration of our YOURLS admin page.
See more: click here