Skip to content

Instantly share code, notes, and snippets.

@pteich
Last active August 29, 2015 14:08
Show Gist options
  • Save pteich/8f326b3af625cdaa9c62 to your computer and use it in GitHub Desktop.
Save pteich/8f326b3af625cdaa9c62 to your computer and use it in GitHub Desktop.
Apache Redirect non www to www subdomain (httpd.conf or .htaccess)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]
RewriteRule ^(.*) http://www.%1$1 [R=301,NE,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment