# HTTP VirtualHost (Port 80)
<VirtualHost *:80>
    ServerName uat-workforceapp.aaleepheonixsolutions.com
    ServerAlias www.uat-workforceapp.aaleepheonixsolutions.com

    RewriteEngine On
    # FIXED: Redirect ALL requests to HTTPS using correct host
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,L]

    ErrorLog ${APACHE_LOG_DIR}/container_error.log
    CustomLog ${APACHE_LOG_DIR}/container_access.log combined
</VirtualHost>

# HTTPS VirtualHost (Port 443)
<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName uat-workforceapp.aaleepheonixsolutions.com
    ServerAlias www.uat-workforceapp.aaleepheonixsolutions.com

    DocumentRoot /var/www/html/public

    <Directory /var/www/html/public>
        AllowOverride All
        Require all granted
        Options -Indexes +FollowSymLinks
    </Directory>

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/uat-workforceapp.aaleepheonixsolutions.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/uat-workforceapp.aaleepheonixsolutions.com/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    ErrorLog ${APACHE_LOG_DIR}/container_error.log
    CustomLog ${APACHE_LOG_DIR}/container_access.log combined
</VirtualHost>
</IfModule>

