# 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" # Block access to .md files Require all denied # Enable .html extension to be optional RewriteEngine On # Don't apply to existing files or directories RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Check if the .html version exists RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.html -f # Internally rewrite to the .html version RewriteRule ^ %{REQUEST_URI}.html [L] # Remove .html extension from direct requests RewriteCond %{THE_REQUEST} \s/+(.+?)\.html[\s?] [NC] RewriteRule ^ /%1 [R=301,L,NE] # 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 403 /403.html ErrorDocument 404 /404.html ErrorDocument 500 /500.html