Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save evemilano/1da76738899808f82c2d to your computer and use it in GitHub Desktop.
Save evemilano/1da76738899808f82c2d to your computer and use it in GitHub Desktop.
Redirezionare tutte le richieste al dominio con ‘www’
RewriteEngine on
# Redirect to domain with www.
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Same for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment