Server-side link redirect tool for UNIX systems utilizing NGINX. Made in bash, and only requires one script to setup. Web tool coming soon.
LinkRedirect allows you to redirect from any URL in your custom domain to any URL on the web, utilizing just NGINX and Linux native functions. You are also able to setup a 404 redirect, and an index redirect. Super-easy setup and usage, made to be flexible.
- A system running Linux/UNIX-based OS
- A system that supports Bash
- NGINX
- Run the file by doing
bash linkredirect.sh
- You should be presented with first-start steps. Follow them accordingly.
-
Domain - please enter your (sub)domain without any prefix (ex. link.aiden.wtf NOT http://link.aiden.wtf)
-
NGINX - by default, if a directory is detected in /etc/nginx/conf.d/, then it will not prompt you. If nothing is found, it will ask you for the path. This path must end in "conf.d/" and, to properly work, all confs in that folder must be getting pulled by NGINX.
-
Alias - if you want to access the program with the simple command
linkredirect
, then this is required, otherwise you will have to run with Bash.
-
NOTE: if you want to move the Config directory from the default (/etc/linkredirect/), you have to edit the file and change the CONFIGDIR & CONFIG variables, located at the top of the file, then reset all settings for the change to take place.
The functions, commands and capabilities of LinkRedirect.
These commands can be used to quickly select a process.
Commands | Usage |
---|---|
linkredirect | directs to main menu |
linkredirect new/shorten | starts URL shorterning process |
linkredirect delete | starts URL deletion process |
linkredirect list | lists all created URLs |
linkredirect reset | directs to reset options |
linkredirect settings | directs to the settings menu |
linkredirect credits | directs to the credit prompt |
The main purpose of this program is to allow you to quickly and efficiently shorten URLs. Here is a quick run-through of how to achieve that.
- Use the
linkredirect new
command OR simply open the program withlinkredirect
, and input 1. - Enter the URL you would like to shorten with the http / https prefix (ex. https://google.com/)
- Enter the extension you would like to associate with this URL (ex. link.aiden.wtf/example)
- Confirm that the URL change provided is correct with
Y
. If you selectN
, it will restart this process. - Go to the link you shorten and watch it redirect!
Sometimes, it may be necessary to delete a URL you either made a mistake in or no longer need. This will show you different ways for efficient deletion.
- Use the
linkredirect delete
command OR open the program, and input 2. If you would like to reset all URLS, refer to the Reset area. - Input
list
for a list of all URLs, and or/then input the EXTENSION (the example in link.aiden.wtf/example). - If that URL is identified it will delete it! The redirect will no longer work.
There are multiple reset options available by default in LinkRedirect, for troubleshooting, or if you just need a fresh start.
- Use the
linkredirect reset
command OR open the program, and input 5, and then input 4. - You should now be presented with a menu, each option on the menu achieves a different result.
- The Reset all URLs option will delete all URLs and reset the database file. This database file will regenerate after next-load.
- The Reset all Options option will delete all configuration files other then the base file. This will effectively make the program act as a "fresh start".
- The Reset NGINX Config File option will delete the configuration file for NGINX. This file will be remade when you try to shorten a URL next.
There is a settings menu present for you to change some customizable options and make the program suit your needs.
- Use the
linkredirect settings
command OR open the program, and input 5. - You should then be prompted with the Settings menu.
- The Create Alias option is identicial to the initial alias process prompted in the first start. This will simply create an alias for the program so you can access it with
linkredirect
commands instead ofbash linkredirect
commands. - The Create 404 Redirect option allows you to set a redirect for any request to your domain under a URL that does not have a valid redirect. (ex. you have not set a explicit redirect for example.com/test, so instead of showing an error, it redirects to the set 404 URL.)
- The Create Index Redirect option allows you to set a redirect for the base domain you have set. (ex. selected domain is example.com, an index redirect would redirect to a URL from example.com)
- The Reset... option redirects you to the aforementioned Reset Options menu. Please read above for further information.
- The Create Alias option is identicial to the initial alias process prompted in the first start. This will simply create an alias for the program so you can access it with
There may be a need to update the software. When a new update is released, you will get a notice everytime you startup the program. Since major bugs may be present, it is advised to update when given notice.
NOTE: In order to push update messages, your device will request information from my API server. If this makes you uncomfortable, feel free to delete the code, present in the start() function.
- First, reset ALL options to ensure a smooth transition. Some configuration settings may be new, and in order to account for those changes you need to reset all options.
- Then, download the new release onto your server, or copy and paste the code the new code (after deleting the old code) inside the
linkredirect.sh
file. - Start the file. You may have to re-undergo the setup process.