Webseiten Hosting/Server Referenzen Kontakt/Impressum

How to create a permanent 301-redirect for Google with Apache

<< Back to overview / Zurück zur Übersicht

The problem: If your webcontent moves to a new domain or if you have several domains with the same content, you have to create a 301-redirect, because otherwise it is possible that your pagerank will suffer ("duplicate content").
The solution:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain1.de$ [NC]
RewriteRule ^(.*) http://www.domain2.de$1 [L,R=301,NE]
RewriteCond %{HTTP_HOST} ^domain1.de$ [NC]
RewriteRule ^(.*) http://www.domain2.de$1 [L,R=301,NE]
Info: domain1.de is the old domain, domain2.de is the new/primary domain. And of course: mod_rewrite needs to be turned on.
Without any warranty - use this information at your own risk.
Tags: apache google redirect rewrite 301 domain duplicate content

Seite zuletzt geändert am: 23.01.2019