Skip to content

Instantly share code, notes, and snippets.

@RyoSugimoto
Last active August 29, 2015 14:12
Show Gist options
  • Save RyoSugimoto/2cb54068873b847bd901 to your computer and use it in GitHub Desktop.
Save RyoSugimoto/2cb54068873b847bd901 to your computer and use it in GitHub Desktop.
URLを「www」付きに統一する(またはその逆)。
# add www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule (.*) http://www.mysite.com/$1 [L,R=301]
# remove www
RewriteEngine on
RewriteCond %{HTTP_HOST} !^mysite\.com [NC]
RewriteRule (.*) http://mysite.com/$1 [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment