# OG Shortlink - Root .htaccess
# Redirect semua requests ke public/ directory

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Allow install folder during installation
    RewriteCond %{REQUEST_URI} ^/install/ [NC]
    RewriteRule ^ - [L]

    # Redirect ke public/ jika file tidak ada di root
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ public/$1 [L,QSA]
</IfModule>

# PHP 8.3 Configuration
<IfModule mod_php.c>
    php_value upload_max_filesize 5M
    php_value post_max_size 5M
    php_value max_execution_time 30
    php_value max_input_time 30
    php_value memory_limit 128M

    # Security
    php_flag display_errors Off
    php_flag display_startup_errors Off
    php_flag expose_php Off
    php_flag log_errors On
</IfModule>

# Deny access to sensitive files
<FilesMatch "^\.">
    Order allow,deny
    Deny from all
</FilesMatch>

<FilesMatch "(composer\.(json|lock)|package(-lock)?\.json|\.env.*|\.git.*|phpunit\.xml|phpstan\.neon|phpcs\.xml)$">
    Order allow,deny
    Deny from all
</FilesMatch>


# php -- BEGIN cPanel-generated handler, do not edit
# Set the “alt-php83” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-alt-php83 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php8_module>
   php_flag display_errors Off
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 256M
   php_value post_max_size 64M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/alt-php83"
   php_value upload_max_filesize 64M
   php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
   php_flag display_errors Off
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 256M
   php_value post_max_size 64M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/alt-php83"
   php_value upload_max_filesize 64M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit
