Want a simple as to use custom domain name URL shortener for free. Well in todays post I’ve got just that and all in under 10 lines of PHP code.
Free URL Shortener PHP Code
Please take notice of this file structure – yourwebsite.com/go/index.php
Create a folder on your domain called go (this could be anything but for sake of tutorial lets create go)
Inside this folder create a file called index.php
Open index.php up and paste the code below into the file and hit save.
You will now need to make a file inside of the go folder called links.txt
Open links text and add your links. You will see below I have included a sample using my own links, this will show you how this works.
As you can see we assign a short text first then the = then the URL to the website we want said short text to link to, Basic stuff 🙂
In order to use your new short links you would do something like this.
Here’s a demo I have already set up using this script – https://ecoincoop.com/go/mte
Personally this is really good for branding, as your now using your company domain to shorten your links instead of sites like bit.ly 🙂 What to say it’s a URL shortener, go shorten the heck out of the internet friends.