Created
February 24, 2014 15:27
-
-
Save pavelbinar/9190394 to your computer and use it in GitHub Desktop.
htaccess redirect non-www to www
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable mod rewrite and restart server | |
a2enmod rewrite | |
service apache2 restart | |
# Edit .htaccess file in domain root directory | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^example.com | |
RewriteRule (.*) http://www.example.com/$1 [R=301,L] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment