Skip to content

Commit

Permalink
ht access
Browse files Browse the repository at this point in the history
  • Loading branch information
BuddhadebKoner committed Feb 22, 2025
1 parent 16f2d1d commit 86c4a81
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions public/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<IfModule mod_rewrite.c>
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
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
</IfModule>

# SEO-friendly URL rewriting example
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html [L]
</IfModule>

0 comments on commit 86c4a81

Please sign in to comment.