Du musst auf jeden Fall dafür sorgen, dass nur eine Variante (also entweder mit oder ohne www) als das "Original" angesehen wird. Die andere leitet nur weiter.
In der .htaccess von Contao (im Basisverzeichnis ursprünglich als .htaccess.default vorhanden, muss dann auf .htaccess umbenannt werden) gibt es eine auskommentierte Lösung hierfür. Du musst dabei einfach nur an der entsprechenden Stelle die # in den jeweiligen Zeilen entfernen und die korrekte Domain angeben.
So sieht das in der 3.1 aus:
Code:
##
# Uncomment the following lines to add "www." to the domain:
#
# RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
# RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
#
# Uncomment the following lines to remove "www." from the domain:
#
# RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
# RewriteRule (.*) http://domain.com/$1 [R=301,L]
#
# Make sure to replace "domain.com" with your domain name.
##
Du änderst das dann z.B. so um:
Code:
##
# Uncomment the following lines to add "www." to the domain:
RewriteCond %{HTTP_HOST} ^kleine-naturfreunde\.de$ [NC]
RewriteRule (.*) http://www.kleine-naturfreunde.de/$1 [R=301,L]
# Uncomment the following lines to remove "www." from the domain:
#
# RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
# RewriteRule (.*) http://domain.com/$1 [R=301,L]
#
# Make sure to replace "domain.com" with your domain name.
##
Dadurch wird die Variante mit www zur korrekten Variante für die Suchmaschinen, die Variante ohne www leitet entsprechend weiter. Achte nur darauf, dass niemals beides gleichzeitig unkommentiert ( von # befreit) ist.
Lesezeichen