# ludiWARE public root
Options -Indexes

# Limites upload photos / formulaires publics (Apache + mod_php ; sinon voir .user.ini)
<IfModule mod_php.c>
	php_value upload_max_filesize 64M
	php_value post_max_size 72M
	php_value max_execution_time 300
	php_value max_input_time 300
</IfModule>
<IfModule mod_php7.c>
	php_value upload_max_filesize 64M
	php_value post_max_size 72M
	php_value max_execution_time 300
	php_value max_input_time 300
</IfModule>
<IfModule mod_php8.c>
	php_value upload_max_filesize 64M
	php_value post_max_size 72M
	php_value max_execution_time 300
	php_value max_input_time 300
</IfModule>

RewriteEngine On

# Forcer HTTPS (sauf localhost)
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteCond %{HTTP_HOST} !^localhost(:\d+)?$ [NC]
RewriteCond %{HTTP_HOST} !^127\.0\.0\.1(:\d+)?$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Zones protégées / pass-through
RewriteRule ^lw-admin(/|$) - [L]
RewriteRule ^database(/|$) - [F,L]
RewriteRule ^uploads(/|$) - [L]
RewriteRule ^functions(/|$) - [F,L]

# Fichiers / dossiers réels
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Tout le reste → index.php (routes /s/{slug}/…)
RewriteRule ^(.*)$ index.php?lw_route=$1 [QSA,L]
