Created
November 29, 2010 12:10
-
-
Save larsschenk/719886 to your computer and use it in GitHub Desktop.
Rewrite rule in apache config to allow only specific server names.
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
# Allow only www.domain.com and www2.domain.com. | |
# Redirect all other server alias names to the main name. | |
# SEO: To avoid "duplicate content" you should have only one allowed server name. | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] [OR] | |
RewriteCond %{HTTP_HOST} !^www2\.domain\.com [NC] [OR] | |
RewriteCond %{HTTP_HOST} !^$ | |
RewriteRule ^/(.*) http://www.domain.com/$1 [L,R=permanent] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment