Skip to content

Instantly share code, notes, and snippets.

Available for New Projects

MS Shohan msshohan

Available for New Projects
View GitHub Profile
ShiponKarmakar / .htaccess
Last active December 17, 2022 07:16
Most Useful and Helpful .htaccess Code
View .htaccess
#stop directory browsing
Options All -Indexes
# SSL Https active Force non-www
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]