Created
February 6, 2019 17:20
-
-
Save hyukishi/5ced7f90d72662ea99a87e809799d74d to your computer and use it in GitHub Desktop.
Add a 301 redirect to point to the https (secure) url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Created by Jeffery Grantham 01/07/2019 | |
| # Purpose: Easily implement 301 redirects into website conf files | |
| # Written for use with apache only | |
| # Usage: 301.sh [.conf file] | |
| FILE=$1 | |
| cd /etc/apache2/sites-available/ | |
| sed "/CustomLog/a\ \tRedirect 301 / https://$FILE.com/" $FILE.conf> tempfile && mv tempfile $FILE.conf | |
| cat $FILE.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment