CodePress/.htaccess
Edwin Noorlander 2e5672ee60 Add secure public directory structure with .htaccess
- Created public/ directory for web-accessible files
- Moved content and assets to public/ subdirectories
- Added .htaccess files for security and routing
- Updated config.php to use public/content path
- Blocked direct access to PHP files and sensitive directories
- Added URL routing to index.php
- Enhanced security headers and PHP settings
2025-11-19 14:00:03 +01:00

44 lines
938 B
ApacheConf

# Security - Block access to entire application
<Files ~ "^\.">
Order allow,deny
Deny from all
</Files>
<FilesMatch "\.(php|ini|log|conf|config|md)$">
Order allow,deny
Deny from all
</FilesMatch>
# Block access to all application files
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Directory protection - Block all access
<Directory />
Order allow,deny
Deny from all
</Directory>
# Only allow access to public directory
<Directory "public">
Order allow,deny
Allow from all
Require all granted
</Directory>
# Set default directory to public
DirectoryIndex public/index.php
# Redirect root to public directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Redirect root to public
RewriteRule ^$ public/ [L]
# Redirect all other requests to public
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>