diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..10ccc86 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,29 @@ + + RewriteEngine On + RewriteBase / + + # Redirect www to non-www (or vice versa, depending on your preference) + RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] + RewriteRule ^(.*)$ http://%1/$1 [R=301,L] + + # Remove trailing slashes (if desired) + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)/$ /$1 [R=301,L] + + # Redirect HTTP to HTTPS (if you have SSL) + RewriteCond %{HTTPS} off + RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] + + # Custom 404 error page + ErrorDocument 404 /404.html + + # Optimize performance with gzip compression + + AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript + + + # SEO-friendly URL rewriting example + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.html [L] +