# Custom URL routing configuration
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
# Enable compression for text files
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
# Set caching headers for static assets
Header set Cache-Control "max-age=86400, public"
# Alias for /blog to serve from the blog directory
Alias "/blog" "/var/www/html/blog"
# Configure DirectoryIndex for both root and blog directory
DirectoryIndex index.html
DirectoryIndex index.html
# Custom error pages
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
# Enable .html extension to be optional
RewriteEngine On
# For URLs like /blog/hello-world (without .html)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ .html [L,QSA]