Ich frickel gerade an der htaccess-datei herum, und komme hier irgendwie ins stolpern.
Ziel:
wenn abschließende slashes nicht vorhanden, soll ein 301 Redirect stattfinden, zur gleichen Adresse mit Slash. Das soll den Eindruck von Doubled-Content vermeiden. (Laut meinen SEO-Unterlagen soll das relevant sein ...)
Soweit ja kein Problem:
Code: Alles auswählen
RewriteCond %{REQUEST_URI} !/$ [NC]
RewriteRule (.*) http://www.domain.com%{REQUEST_URI}/ [R=301,L]
Die Frage ist also; wie bekomme ich das hin, dass die oben genannte Regel nur dann angewendet wird, wenn zuvor kein Redirect stattgefunden hat? Gibts sowas wie refrerrer in Mod_rewrite?
Oder hat jemand eine andere Idee? Ansonsten läuft meine angepasste htaccess genauso, wie ich mir das vorstelle. Hier das komplette Teil:
Code: Alles auswählen
#AddHandler php-cgi .php .php4
# Während der Entwicklung darf nur ich gucken:
order deny,allow
deny from all
allow from XX.XX.XXX.XXX # meine IP
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !/$ [NC]
RewriteRule (.*) http://www.domain.com%{REQUEST_URI}/ [R=301,L]
RewriteCond %{HTTP_HOST} !^www.domain.com [NC]
RewriteRule (.*) http://www.domain.com%{REQUEST_URI} [R=301,L]
# achtung bitte basisverzeichnis anpassen!
RewriteBase /cmr-415/cms
# ausnahmen für verzeichnisse der mod_rewrite regel:
# verzeichnisse ausschließen
RewriteRule ^usage/.*$ - [L]
# das kann beliebig erweitert werden:
RewriteRule ^de/error/.*$ - [L]
# (...)
# detect url injection in query string
RewriteCond %{REQUEST_URI} !^.*attackmsg.php.* [NC]
RewriteCond %{QUERY_STRING} ^.*ftp://.*$ [NC,OR]
RewriteCond %{QUERY_STRING} ^.*http[s]*://.*$ [NC]
RewriteRule ^(.*)$ attackmsg.php?attack_request=/$1 [L,NS,QSA]
# dank an panti aus dem contenido-forum fuer
# rewrite rule ohne abschlieszenden slash in der url
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*).html$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6&parts[]=$7&parts[]=$8&artname=$9 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6&parts[]=$7&parts[]=$8 [QSA,L]
# RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/\.]+)$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6&parts[]=$7&parts[]=$8 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*).html$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6&parts[]=$7&artname=$8 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6&parts[]=$7 [QSA,L]
# RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/\.]+)$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6&parts[]=$7 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*).html$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6&artname=$7 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6 [QSA,L]
# RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/\.]+)$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&parts[]=$6 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*).html$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5&artname=$6 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5 [QSA,L]
# RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/\.]+)$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&parts[]=$5 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.*).html$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4&artname=$5 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4 [QSA,L]
# RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/\.]+)$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&parts[]=$4 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/(.*).html$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3&artname=$4 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3 [QSA,L]
# RewriteRule ^([^/]+)/([^/]+)/([^/\.]+)$ front_content.php?parts[]=$1&parts[]=$2&parts[]=$3 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/(.*).html$ front_content.php?parts[]=$1&parts[]=$2&artname=$3 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/$ front_content.php?parts[]=$1&parts[]=$2 [QSA,L]
# RewriteRule ^([^/]+)/([^/\.]+)$ front_content.php?parts[]=$1&parts[]=$2 [QSA,L]
RewriteRule ^([^/]+)/(.*).html$ front_content.php?parts[]=$1&artname=$2 [QSA,L]
RewriteRule ^([^/]+)/$ front_content.php?parts[]=$1 [QSA,L]
# RewriteRule ^([^/\.]+)$ front_content.php?parts[]=$1 [QSA,L]
RewriteRule ^(.*).html$ front_content.php?artname=$1 [QSA,L]
RewriteRule ^$ front_content.php [QSA,L]
</IfModule>