Skip to content

Instantly share code, notes, and snippets.

@devig
Created May 24, 2023 10:33
Show Gist options
  • Save devig/f704598693df8ec5ef00b56ab9f67d8c to your computer and use it in GitHub Desktop.
Save devig/f704598693df8ec5ef00b56ab9f67d8c to your computer and use it in GitHub Desktop.
htaccess redirect www to non-www https and from index.html
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteEngine On
#Если у Вас переход на index.html:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ https://site.com/ [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment