Skip to content

Instantly share code, notes, and snippets.

@bugnumber9
Created November 24, 2025 14:22
Show Gist options
  • Select an option

  • Save bugnumber9/fe6b8bc9ca5d32b3f241d77c6352df4c to your computer and use it in GitHub Desktop.

Select an option

Save bugnumber9/fe6b8bc9ca5d32b3f241d77c6352df4c to your computer and use it in GitHub Desktop.
www to non-www redirection (.htaccess)
RewriteCond %{HTTP_HOST} ^www\. [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^ https://%1%{REQUEST_URI} [NE,L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment