#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#configure apache
echo "# added by ImageBuilder
AllowOverride All
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
order allow,deny
deny from all
# deny access to login and admin on this host...
deny from all
deny from all
AllowOverride AuthConfig
# Directory on the disk to contain cached files
CacheRoot \"/var/cache/httpd/proxy\"
# Cache all
CacheEnable disk \"/\"
# Enable cache and set 15-minute caching as the default
ExpiresActive On
ExpiresDefault \"access plus 15 minutes\"
# Force no caching for PHP files
ExpiresActive Off
" > /etc/httpd/conf.d/wordpress.conf
apachectl restart
systemctl restart php-fpm