Ergebnis 1 bis 4 von 4

Thema: 301-Weiterleitung funktioniert nicht mit redirect4ward

  1. #1
    Contao-Nutzer
    Registriert seit
    26.06.2010.
    Beiträge
    59

    Standard 301-Weiterleitung funktioniert nicht mit redirect4ward

    Hallo liebe Contao-Gemeinde,

    nun habe ich meine erste Contao-Seite im Netz. Die alte Seite hatte als Endung *.htm und die Contao-Seite hat ja *.html. Deshalb habe ich mit redirect4ward eine Weiterleitung eingerichtet und die .htaccess-Datei bearbeitet, aber irgendwie kommt, wenn ich eine htm-Seite aufrufe, immer die 404-Seite.

    Vielleicht ist auch was an der .htaccess falsch? Ich kopiere die mal hier rein. Evtl. fällt ja jemandem der Fehler sofort auf:

    PHP-Code:
    <IfModule mod_deflate.c>

      
    ##
      # Use mod_deflate to compress JavaScript, CSS and XML files. Do not add
      # PHP and HTML files, because those have already been compressed by Contao.
      ##
      
    <FilesMatch "\.(css|js|xml)$">
        
    SetOutputFilter DEFLATE
      
    </FilesMatch>

    </
    IfModule>

    <
    IfModule mod_headers.c>

      
    ##
      # Add a Vary Accept-Encoding header for the compressed resources. If you
      # modify the file types above, make sure to change them here accordingly.
      ##
      
    <FilesMatch "\.(js|css|xml|gz)$">
        
    Header append Vary Accept-Encoding
      
    </FilesMatch>

    </
    IfModule>

    <
    IfModule mod_expires.c>
      
    ExpiresActive On

      
    ##
      # Specify an expiration one week in the future for images, JavaScripts and
      # CSS files (as recommended by Google Page Speed). Edit or remove the lines
      # to set up your own expiration logic.
      ##
      
    ExpiresByType image/png A604800
      ExpiresByType image
    /gif A604800
      ExpiresByType image
    /jpg A604800
      ExpiresByType image
    /jpeg A604800
      ExpiresByType text
    /javascript A604800
      ExpiresByType application
    /x-javascript A604800
      ExpiresByType text
    /css A604800

    </IfModule>

    <
    IfModule mod_rewrite.c>
      
    RewriteEngine On

      
    ##
      # Set the RewriteBase if your Contao installation is in a subdirectoy and
      # the rewrite rules are not working properly. Usage examples:
      #
      #   RewriteBase /contao-2.9.0
      #   RewriteBase /path/to/contao
      #
      # Uncomment the following line to set the RewriteBase.
      ##
      #RewriteBase /cms-seelencoaching

      ##
      # Contao usually does not pass absolute URLs via GET, therefore the
      # following rules block all requests that try to pass a URL or the /etc/
      # directory as parameter (malicious requests).
      ##
      
    RewriteCond %{REQUEST_URI} (ftp|https?):|/etc/ [NC,OR]
      
    RewriteCond %{QUERY_STRING} (ftp|https?):|/etc/ [NC]
      
    RewriteRule .* - [F,L]

      
    ##
      # Uncomment the following lines and replace "domain.com" with your domain
      # name to redirect requests without "www" to the correct domain.
      ##
      #RewriteCond %{HTTP_HOST} ^seelencoaching2012\.de [NC]
      #RewriteRule (.*) http://www.seelencoaching2012.de/$1 [R=301,L]

      ##
      # Do not rewrite requests for static files or folders such as style sheets,
      # images, movies or text documents.
      ##
      
    RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond 
    %{REQUEST_FILENAME} !-d
      RewriteRule 
    .*\.htmindex.php [L]



      
    ##
      # By default, Contao adds ".html" to the generated URLs to simulate static
      # HTML documents. If you change the URL suffix in the back end settings, make
      # sure to change it here accordingly!
      #
      #   RewriteRule .*\.html$ index.php [L]   # URL suffix .html
      #   RewriteRule .* index.php [L]          # No URL suffix
      #   RewriteRule .*\.txt$ index.php [L]    # URL suffix .txt
      #
      # If you are using mod_cache, it is recommended to use the RewriteRule below,
      # which adds the query string to the internal URL:
      #
      #   RewriteRule (.*\.html)$ index.php/$1 [L]
      #
      # Note that not all environments support mod_rewrite and mod_cache!
      ##
      
    RewriteRule .*\.htmlindex.php [L]

    </
    IfModule
    Was mich auch verwirrt, ist, dass verschiedene Browser unterschiedlich reagieren. Wenn ich z.B. im Opera eine alte htm-Seite aufrufe, dann kommt die Fehlermeldung "Ein Zugriff auf den Server ist nicht möglich", während im Firefox 4 ich auf die jetzige Startseite weitergeleitet werde.

    Vielleicht kann mir ja jemand durch diesen .htaccess- und 301-Dschungel helfen?

    Danke schon mal im voraus und liebe Grüße,
    Sunnygarden

  2. #2
    AG Core-Entwicklung Avatar von Psi
    Registriert seit
    19.06.2009.
    Ort
    Mittelfranken
    Beiträge
    930
    Partner-ID
    5583
    User beschenken
    Wunschliste

    Standard

    Auf alle fälle sollte vor jedem RewriteRule auch die RewriteConds stehen:

    HTML-Code:
    # HTM-Weiterleitung
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule .*.htm$ index.php [L] 
    
    # HTML-Weiterleitung
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule .*.html$ index.php [L] 
    Wie sehen deine Einträge im Rewrite4ward aus?

  3. #3
    Contao-Nutzer
    Registriert seit
    26.06.2010.
    Beiträge
    59

    Standard

    Hallo Psi,

    heißt das, dass die .htaccess so aussehen sollte?

    PHP-Code:
    <IfModule mod_deflate.c>

      
    ##
      # Use mod_deflate to compress JavaScript, CSS and XML files. Do not add
      # PHP and HTML files, because those have already been compressed by Contao.
      ##
      
    <FilesMatch "\.(css|js|xml)$">
        
    SetOutputFilter DEFLATE
      
    </FilesMatch>

    </
    IfModule>

    <
    IfModule mod_headers.c>

      
    ##
      # Add a Vary Accept-Encoding header for the compressed resources. If you
      # modify the file types above, make sure to change them here accordingly.
      ##
      
    <FilesMatch "\.(js|css|xml|gz)$">
        
    Header append Vary Accept-Encoding
      
    </FilesMatch>

    </
    IfModule>

    <
    IfModule mod_expires.c>
      
    ExpiresActive On

      
    ##
      # Specify an expiration one week in the future for images, JavaScripts and
      # CSS files (as recommended by Google Page Speed). Edit or remove the lines
      # to set up your own expiration logic.
      ##
      
    ExpiresByType image/png A604800
      ExpiresByType image
    /gif A604800
      ExpiresByType image
    /jpg A604800
      ExpiresByType image
    /jpeg A604800
      ExpiresByType text
    /javascript A604800
      ExpiresByType application
    /x-javascript A604800
      ExpiresByType text
    /css A604800

    </IfModule>

    <
    IfModule mod_rewrite.c>
      
    RewriteEngine On

      
    ##
      # Set the RewriteBase if your Contao installation is in a subdirectoy and
      # the rewrite rules are not working properly. Usage examples:
      #
      #   RewriteBase /contao-2.9.0
      #   RewriteBase /path/to/contao
      #
      # Uncomment the following line to set the RewriteBase.
      ##
      #RewriteBase /cms-seelencoaching

      ##
      # Contao usually does not pass absolute URLs via GET, therefore the
      # following rules block all requests that try to pass a URL or the /etc/
      # directory as parameter (malicious requests).
      ##
      
    RewriteCond %{REQUEST_URI} (ftp|https?):|/etc/ [NC,OR]
      
    RewriteCond %{QUERY_STRING} (ftp|https?):|/etc/ [NC]
      
    RewriteRule .* - [F,L]

      
    ##
      # Uncomment the following lines and replace "domain.com" with your domain
      # name to redirect requests without "www" to the correct domain.
      ##
      #RewriteCond %{HTTP_HOST} ^seelencoaching2012\.de [NC]
      #RewriteRule (.*) http://www.seelencoaching2012.de/$1 [R=301,L]

      ##
      # Do not rewrite requests for static files or folders such as style sheets,
      # images, movies or text documents.
      ##
    # HTM-Weiterleitung
      
    RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond 
    %{REQUEST_FILENAME} !-d
      RewriteRule 
    .*.htmindex.php [L]

    # HTML-Weiterleitung
      
    RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond 
    %{REQUEST_FILENAME} !-d
      RewriteRule 
    .*.htmlindex.php [L]




      
    ##
      # By default, Contao adds ".html" to the generated URLs to simulate static
      # HTML documents. If you change the URL suffix in the back end settings, make
      # sure to change it here accordingly!
      #
      #   RewriteRule .*\.html$ index.php [L]   # URL suffix .html
      #   RewriteRule .* index.php [L]          # No URL suffix
      #   RewriteRule .*\.txt$ index.php [L]    # URL suffix .txt
      #
      # If you are using mod_cache, it is recommended to use the RewriteRule below,
      # which adds the query string to the internal URL:
      #
      #   RewriteRule (.*\.html)$ index.php/$1 [L]
      #
      # Note that not all environments support mod_rewrite and mod_cache!
      ##


    </IfModule
    In Rewrite4ward sieht es so aus, dass der Zieltyp "Interne Weiterleitung" ist, die URL beispielsweise so eingegeben wurde: seelencoaching2012/ablauf.htm

    Dann habe ich bei Host "jeder Host" zu stehen und die entsprechende Seite ausgewählt, auf die umgeleitet werden soll (Umleitungsziel).

    Typ ist permanente Weiterleitung 301 und bei "Aktiviert" habe ich ein Häkchen gesetzt.

    Wo ist jetzt der Fehler?

    Dankeschön schon mal für Deine Hilfe und liebe Grüße,
    Sunnygarden

  4. #4
    Contao-Nutzer
    Registriert seit
    26.06.2010.
    Beiträge
    59

    Standard

    Hallo,

    seit ich die zuletzt zitierte .htaccess hochgeladen habe, hat die Webseite kurioserweise gar keine Besucher mehr. Ich hab echt keine Idee, wie das kommt. Was kann ich denn da bloß tun?

    Gruß,
    Sunnygarden

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •