Skip to content

Instantly share code, notes, and snippets.

@benjamin-dk
Last active November 10, 2015 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjamin-dk/8d121f5dbd30da959af5 to your computer and use it in GitHub Desktop.
Save benjamin-dk/8d121f5dbd30da959af5 to your computer and use it in GitHub Desktop.
Fix default Drupal .htaccess settings to comply with new Apache (2.4) standards
#!/bin/bash
# Searches the current working directory recursively and replaces old symlink-setting with the new
read -p "This script should be run from the Drupal root folder to work properly. Is this our current location?" -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
curdir=$(pwd)
filetofix="${curdir}/.htaccess"
if [ -e "$filetofix" ]
then
echo "$filetofix exists."
find ${curdir} -name .htaccess -exec sed -i 's/FollowSymLinks/SymLinksIfOwnerMatch/g' {} \;
fi
echo "Replacing FollowSymLinks with SymLinksIfOwnerMatch in the following .htaccess files:"
find . -name .htaccess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment