The least amount of code I could use to redirect traffic to another site. Made to be deployed to heroku.
Just set the environment variables SITENAME and SITEURL in your heroku configuration and you should be good to go.
If you want to test this, I've included a basic Dockerfile.
$ docker build -t test-php-app .
$ docker run -p $YOURPORTNAME:80 -e "SITENAME=$YOURSITENAME" -e "SITEURL=$YOURSITEURL" --rm php-testThen visit the page at "localhost:$YOURPORTNAME/index.php".