Skip to content

Simple bash script to ensure that hosts are redirecting properly

License

Notifications You must be signed in to change notification settings

samerziade/redirects-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

HTTP Redirects Tester

This is a very simple Bash script which will help you quickly check the redirects statuses of hosts you're setting up. It's useful for projects that require you to redirect lots of domains to a single one and you need to check that they're all redirecting properly.

The script itself is very simple, and all it does is reads out the Location HTTP header to ensure that it's redirecting to the expected location based on the expect variable you set.

Usage

In the file, you'll have to set up the expect, schemes, and domains variables:

expect="https://example.com/"

schemes=(
  http
  https
)

domains=(
  www.example.com
)

Once setup, you may execute the script without any arguments:

./check.sh

Sample Output

The sample below aren't based exactly on the variables set above, they're just there to demonstrate the different output states.

$ ./check.sh
www.example.com
 ✔ http
 ✔ https

example.com
 ✔ http
 * Skipping https://example.com/

 www.example.net
 × NOT FOUND (http)
 × NOT FOUND (https)

About

Simple bash script to ensure that hosts are redirecting properly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages