# Hostxolo Website Configuration

# Enable rewrite engine (if available)
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /hostxolo/
    
    # Remove .php extension from URLs
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)$ $1.php [L]
</IfModule>

# Custom error pages (comment out if causing issues)
# ErrorDocument 404 /hostxolo/404.php
# ErrorDocument 500 /hostxolo/500.php

# Protect sensitive files
<IfModule mod_authz_core.c>
    <FilesMatch "^\.">
        Require all denied
    </FilesMatch>
    
    <FilesMatch "(database\.sql|config\.php|\.gitignore|\.htaccess)$">
        Require all denied
    </FilesMatch>
</IfModule>

<IfModule !mod_authz_core.c>
    <FilesMatch "^\.">
        Order allow,deny
        Deny from all
    </FilesMatch>
    
    <FilesMatch "(database\.sql|config\.php|\.gitignore|\.htaccess)$">
        Order allow,deny
        Deny from all
    </FilesMatch>
</IfModule>

# Enable gzip compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

# Set caching headers
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
</IfModule>

# PHP settings
<IfModule mod_php.c>
    php_value upload_max_filesize 5M
    php_value post_max_size 5M
    php_value max_execution_time 300
    php_value max_input_time 300
</IfModule>
