<VirtualHost 127.0.0.1:443 _default_:443>
  ServerName www.example.com
  ServerAlias *
  SSLEngine on
  SSLCertificateFile "/opt/bitnami/apache/conf/risingnationug.com.crt"
  SSLCertificateKeyFile "/opt/bitnami/apache/conf/risingnationug.com.key"
  DocumentRoot /opt/bitnami/wordpress
  # BEGIN: Configuration for letsencrypt
  Include "/opt/bitnami/apps/letsencrypt/conf/httpd-prefix.conf"
  # END: Configuration for letsencrypt
  # BEGIN: Support domain renewal when using mod_proxy without Location
  <IfModule mod_proxy.c>
    ProxyPass /.well-known !
  </IfModule>
  # END: Support domain renewal when using mod_proxy without Location
  # BEGIN: Enable non-www to www redirection
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^localhost
  RewriteCond %{HTTP_HOST} !^[0-9]+.[0-9]+.[0-9]+.[0-9]+(:[0-9]+)?$
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]
  # END: Enable non-www to www redirection
  <Directory "/opt/bitnami/wordpress">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride None
    Require all granted
    # BEGIN WordPress fix for plugins and themes
    # Certain WordPress plugins and themes do not properly link to PHP files because of symbolic links
    # https://github.com/bitnami/bitnami-docker-wordpress-nginx/issues/43
    RewriteEngine On
    RewriteRule ^bitnami/wordpress(/.*) $1 [L]
    # END WordPress fix for plugins and themes
    # BEGIN WordPress
    # https://wordpress.org/support/article/htaccess/#basic-wp
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    # BEGIN Disable WordPress XML-RPC endpoint
    # Disable the outdated WordPress XML-RPC endpoint to prevent security vulnerabilities.
    # https://github.com/bitnami/containers/pull/51077
    <Files xmlrpc.php>
    Order Allow,Deny
    Deny from all
    </Files>
    # END Disable WordPress XML-RPC endpoint
  </Directory>
  Include "/opt/bitnami/apache/conf/vhosts/htaccess/wordpress-htaccess.conf"
  # BEGIN: Support domain renewal when using mod_proxy within Location
  <Location /.well-known>
    <IfModule mod_proxy.c>
      ProxyPass !
    </IfModule>
  </Location>
  # END: Support domain renewal when using mod_proxy within Location
</VirtualHost>
