Last active
March 30, 2017 18:07
-
-
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
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
| # 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is useful for to provision an http:alpine Web server on container startup, rather than copying the entire httpd.conf into the image.