Last active
December 11, 2015 10:18
-
-
Save elvisciotti/4585785 to your computer and use it in GitHub Desktop.
Apache htaccess/virtualhost rule to redirect 301 non-www version to www-version (to avoid duplicate URLs on search engines)
e.g. example.org/one/two -> www.example.org/one/two
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
# .htaccess or Apache vhost | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment