cms/.htaccess

48 lines
1.4 KiB
ApacheConf

# Włącz mod_rewrite
RewriteEngine On
RewriteBase /cms/
# Przekierowanie do HTTPS (opcjonalne, odkomentuj jeśli używasz SSL)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Jeśli plik lub katalog istnieje, wyświetl go
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# W przeciwnym razie przekieruj do index.php
RewriteRule ^([a-zA-Z0-9-_]+)/?$ index.php?page=$1 [L,QSA]
# Zabezpieczenia
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|sql)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# Ochrona plików konfiguracyjnych
<Files "config/database.php">
Order Allow,Deny
Deny from all
</Files>
# Włącz kompresję
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>
# Cache przeglądarki
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
# Zwiększ limit uploadów (jeśli możliwe)
php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_execution_time 300
php_value max_input_time 300