Mod rewrite Code Library

Code Library - Canonical Domain Sabotage

Security
Canonical Domain Sabotage (Duplicate Search Engine Penalties)

htaccess code
RewriteCond %{HTTP_HOST} !^www\.domain
RewriteCond %{HTTP_HOST} !^sub1\.domain [NC]
RewriteCond %{HTTP_HOST} !^sub2\.domain [NC]
RewriteCond %{HTTP_HOST} !^sub3\.domain [NC]
RewriteCond %{HTTP_HOST} !^sub4\.domain [NC]
RewriteCond %{HTTP_HOST} !^sub5\.domain [NC]
RewriteRule (.*) http //www.domain.com/$1 [R=301,L]

home | blog | tutorials | code library

Questions that are answered here:

  • How do I prevent duplicate penalties in the search engines for my website?
  • How do prevent Canonical Domain Sabotage?
  • How to redirect all non www. urls to www. urls on my site?
  • How to allow subdomains while redirecting non www. urls to www. urls?


 

Mod Rewrite (Home) | Mod Rewrite Tutorials | Directory | Code Library | Blog | Mod Rewrite Quick Guide

copyright © 2001 - 2008 Webforgers.net
All rights reserved.