# Arkland Properties - Public Directory .htaccess # Front Controller for routing RewriteEngine On # Set base path (adjust if needed) RewriteBase /public/ # Remove trailing slashes RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect www to non-www (SEO) RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] # Redirect HTTP to HTTPS (enable if SSL is installed) # RewriteCond %{HTTPS} off # RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] # If requested file exists, serve it directly RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] # If requested directory exists, serve it directly RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] # Route all other requests to index.php RewriteRule ^ index.php [L] # Block access to hidden files RewriteCond %{SCRIPT_FILENAME} -d [OR] RewriteCond %{SCRIPT_FILENAME} -f RewriteRule "(^|/)\." - [F] # Caching for static assets 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 image/webp "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" ExpiresByType application/javascript "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType font/woff "access plus 1 year" ExpiresByType font/woff2 "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" # Compress files AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript application/json application/xml application/rss+xml image/svg+xml # Security headers in public directory Header set X-Content-Type-Options "nosniff" Header set X-Frame-Options "SAMEORIGIN" Header set X-XSS-Protection "1; mode=block" # Cache static assets Header set Cache-Control "max-age=2592000, public" # No cache for HTML/PHP files Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate" # Custom error pages ErrorDocument 400 /index.php?error=400 ErrorDocument 401 /index.php?error=401 ErrorDocument 403 /index.php?error=403 ErrorDocument 404 /index.php?error=404 ErrorDocument 500 /index.php?error=500