Skip to content

Instantly share code, notes, and snippets.

@asciimo
Last active March 30, 2017 18:07
Show Gist options
  • Select an option

  • Save asciimo/4219c48d22b816d63a2abc20d4072264 to your computer and use it in GitHub Desktop.

Select an option

Save asciimo/4219c48d22b816d63a2abc20d4072264 to your computer and use it in GitHub Desktop.
Shell script to modify httpd.conf to allow mod_rewrite in .htaccess files
# Update the 2nd instance of AllowOverride, which is in the docroot Directory directive
perl -pi -e 's{AllowOverride None}{++$n == 1 ? "AllowOverride All" : $&}ge' /usr/local/apache2/conf/httpd.conf
# Tack the mod_rewrite module load on to the end of the file
echo 'LoadModule rewrite_module modules/mod_rewrite.so' >> /usr/local/apache2/conf/httpd.conf
@asciimo

asciimo commented Mar 30, 2017

Copy link
Copy Markdown
Author

This is useful for to provision an http:alpine Web server on container startup, rather than copying the entire httpd.conf into the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment