Skip to main content

How to setup a PHP Web Redirect

This guide will help you set up an automatic website redirect on your node.
This is useful so that someone can go to CALSIGN.vk44.net and it will automatically take them to the Supermon Page on your node (CALLSIGN.vk44.net/supermon).

Requirements

In order to use this guide, you need to already have an operational node on the network and a web service running on your node.
If you have Supermon working, you already have a web server ready to go!

Instructions

NOTE: These Instructions are in DRAFT, please let us know on the Support Chat if they work okay for you!

 
  1. Connect to the Linux device via SSH.
  2. Find the root directory of your web service that is running on the node.
    1. This can typically be found in either of the two options below...
      1.  /var/www/html/    - This one is correct for AllStar Link Nodes
      2. /srv/http/    - This one is typical for HamVOIP Nodes.
  3. Change the directory into the correct web service root directory (for one of the above options).
cd /var/www/html/

# OR

cd /srv/http/

4. Next you want to see what files are currently in the directory and look for an index.html or index.php file. The following command (ls -lh) will show you want files are in the directory you are currently located in.

ls -lh

5. You should see something like the following.

image.png

6. We need to create a backup of the current index.php or index.html file you currently have with the following command.

mv index.php index.php.bac

# OR

mv index.html index.html.bac

7. We will now create a new file with your redirect for your supermon page using a basic PHP script.

nano index.php

 8. The above command would have brought up a window to type text. Copy and paste the below text into the window.

Make sure to adjust the node number to your nodes Allstar Link Node Number.

<?php
header("Location: /supermon/link.php?nodes=INSERTNODENUMBERHERE");
?>
  1. Ctrl + X to close
  2. Y to save

The file would have looked something like this...

image.png

9. Time for some testing! Open up a new browser window and navigate to https://CALLSIGN.vk44.net and you should be automatically redirected to your Supermon Page for your chosen Node Number.

If you are not being automatically redirected, try on a different browser (or in incognito mode) as your web browser has possibly cached the website on your device.
You can also achieve that same by clearing your web browsers cache.

10. Time for some cleanup! If you are happy with the above result, you will no longer require the backup file we created of your index file earlier (index.php.bac OR index.html.bac).
    - It is good practise to now delete those backup files to keep your web service running smoothly and as clean as possible.

10a. If you have read, and understood step 10, and are happy to now delete the backup files, use one of the below commands depending on the command you used above.

# If you used "mv index.html index.html.bac" above, use...
rm index.html.bac

# OR

#If you used "mv index.php index.php.bac" above, use...
rm index.php.bac

For additional assistance, please reach out to us in the Support: VK44.NET Support Chat on the Dashboard.