Skip to content

Instantly share code, notes, and snippets.

@headquarters
Created October 6, 2017 20:21
Show Gist options
  • Select an option

  • Save headquarters/dd0f4720189d7a1e773a9088e45de884 to your computer and use it in GitHub Desktop.

Select an option

Save headquarters/dd0f4720189d7a1e773a9088e45de884 to your computer and use it in GitHub Desktop.
Webfaction http->https and www redirect rules
# webapps/michaelehead_redirect/.htaccess
# michaelehead_redirect
# | - http://michaelehead.com
# | - http://www.michaelehead.com
# This simply redirects all traffic to https://www (with or without www) to the app itself at “michaelehead”.
# That app’s redirect rules then take care of the www portion.
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ https://www.michaelehead.com/$1 [R=301,L]
# webapps/michaelehead/.htaccess
# michaelehead
# | - https://michaelehead.com
# | - https://www.michaelehead.com
# If a request comes in without the www at the beginning, it redirects to https://www as necessary.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^michaelehead.com$ [NC]
RewriteRule ^(.*)$ https://www.michaelehead.com/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment