Contao-Camp 2024
Ergebnis 1 bis 33 von 33

Thema: HTTPS SSL Contao 4

  1. #1
    Contao-Nutzer
    Registriert seit
    04.12.2009.
    Beiträge
    86

    Standard HTTPS SSL Contao 4

    Hallo,

    ich möchte gerne SSL einrichten, ein Zertifikat ist vorhanden und aktiv.

    Welche Änderungen muss ich in der web/.htaccess durchführen ?
    Kann der Standard .htaccess File bestehen bleiben reicht es wenn ich das hier hinzufüge ?
    Möchte nur HTTPS aktivieren mehr nicht, muss in Contao 4 selbst noch was für die Sitemap eingestellt werden ?

    # HTTPS aktivieren
    RewriteCond %{HTTPS} !=on
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

    https://www.marcosimbuerger.ch/conta...inrichten.html



    Hier wird Port 80 angesprochen, und was ist R=301 ?

    https://erdmann-freunde.de/logbuch/contao-https-ssl/

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]





    Danke für die Hilfe, sorry für die dumme Frage möchte es nicht verkehrt machen.

  2. #2
    Contao-Fan Avatar von fusch
    Registriert seit
    25.03.2012.
    Ort
    München
    Beiträge
    498
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Guck mal hier, das wird das Ganze ein bißchen ausführlicher erklärt:
    https://www.redirect301.de/weiterlei...tp-nach-https/
    Es gibt mehrere richtige Möglichkeiten.

    Gruß
    Hella

    P.S.: Bei manchen Hostern (zb Webgo) gibt es die Möglichkeit nach Einrichtung des Zertifikats die Domain komplett auf https umzuleiten, da musst Du Dich um gar nichts weiter kümmern.
    Mitglied des Contao User Treffen München
    Aktuelle Termine erfährst Du immer unter www.contao-bayern.de
    Komm' doch mal vorbei!

  3. #3
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Zitat Zitat von Zwergenmeister Beitrag anzeigen
    Welche Änderungen muss ich in der web/.htaccess durchführen ?
    Prinzipiell keine (von einer Weiterleitung mal abgesehen).



    Zitat Zitat von Zwergenmeister Beitrag anzeigen
    Möchte nur HTTPS aktivieren mehr nicht, muss in Contao 4 selbst noch was für die Sitemap eingestellt werden ?
    Ja, bei den jeweiligen Website Startpunkten musst du die Option "HTTPS verwenden" aktivieren.



    Zitat Zitat von Zwergenmeister Beitrag anzeigen
    # HTTPS aktivieren
    RewriteCond %{HTTPS} !=on
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    Das "aktiviert" nicht HTTPS. Damit leitest du HTTP Anfragen auf HTTPS weiter. Ich würde eher folgende Regeln verwenden:
    Code:
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    Das ist aber auch mehr oder weniger nur Geschmackssache



    Zitat Zitat von Zwergenmeister Beitrag anzeigen
    und was ist R=301 ?
    R bedeutet Redirect und mit =301 gibst du an, mit welchem Status Code weitergeleitet werden soll (301 = permanente Weiterleitung).

  4. #4
    Contao-Nutzer
    Registriert seit
    04.12.2009.
    Beiträge
    86

    Standard

    Zitat Zitat von Spooky Beitrag anzeigen
    Prinzipiell keine (von einer Weiterleitung mal abgesehen).

    Ja, bei den jeweiligen Website Startpunkten musst du die Option "HTTPS verwenden" aktivieren.
    Danke euch beiden für die Mega schnelle Antwort.

    @ Spooky habe meine Zeilen aus der htaccess gelöscht und benutze wieder den Standard, habe dann im Startpunkt "HTTPS verwenden" aktivieren. Das reicht dann auch schon, wenn ich dich richtig verstanden habe. .-) Zumindest wird direkt auf https weitergeleitet.

    Irgendwelche Einwände oder Gründe dagegen ?


    Danke

  5. #5
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Zitat Zitat von Zwergenmeister Beitrag anzeigen
    Zumindest wird direkt auf https weitergeleitet.
    Nein, Contao macht diese Weiterleitung nicht automatisch.

  6. #6
    Contao-Nutzer
    Registriert seit
    04.12.2009.
    Beiträge
    86

    Standard

    schon gemerkt der Cache :-((( Danke nutze deine Lösung jetzt

  7. #7
    Community-Moderatorin & Contao-Urgestein Avatar von mlweb
    Registriert seit
    10.07.2011.
    Beiträge
    6.742
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Manchmal gibt es beim Provider auch Einstellung die grundsätzlich alle Anfragen auf https weiterleiten.
    Ich habe Dir mit meinen Hinweisen geholfen und Du möchtest Dich bedanken?
    Unterstütze bitte das Contao-Projekt (Button Links)
    Weitere Spendenmöglichkeiten
    ------------------------------------------------------------------------------------------------------
    Contao-Dokumentation: Contao-Handbuch und Contao-Entwickler-Doku
    Contao-Online-Video-Kurse: Contao Academy
    Funktionalität erweitern: Contao-Erweiterungen

    Für Dinge die man mit html5 und css3 lösen kann, braucht man kein javascript.




  8. #8
    Contao-Fan Avatar von Marchie
    Registriert seit
    12.01.2012.
    Ort
    Schwaikheim
    Beiträge
    303

    Standard

    Hallo zusammen,

    bei mir klappt diese Weiterleitung auch nicht. Ich habe verschiedene Anweisungen probiert, aber nichts zieht. Aktuell steht das hier in der htaccess:
    PHP-Code:
         RewriteCond %{HTTP_HOST} ^schlosserei-schluesselnotdienst\.de$ [NC]
         
    RewriteRule (.*) http://www.schlosserei-schluesselnotdienst.de/$1 [R=301,L]
         
         
    RewriteCond %{SERVER_PORT}  !^443$
         
    RewriteRule (.*)  https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
        
         
    RewriteCond %{REQUEST_URI} !/$
         
    RewriteCond %{SERVER_PORT443
         RewriteCond 
    %{REQUEST_FILENAME} -d
         RewriteRule 
    ^(.*) https://%{SERVER_NAME}/$1/ [R=301,L] 
    Das ist das, was bislang bei Contao 3.5.x bestens funzt auf demselben Server. Und die .htaccess greift auch, denn die Umleitung auf "www" klappt. Nur https nicht. Hat jemand eine Idee, woran das liegen kann. Eine bestimmte Stelle in der .htaccess?

  9. #9
    Contao-Fan Avatar von Hoch-3
    Registriert seit
    16.11.2010.
    Ort
    Zürich
    Beiträge
    373
    Partner-ID
    7136

    Standard Contao 4.4 https Weiterleitung wie?

    Mein Problem im Contao 4.4 ist, dass entweder die Site nicht weiter geleitet wird oder es einen Umleitungsfehler wegen zu vielen Umleitungen gibt. Je nachdem, wo ich die zwei Code-Zeilen im htaccess eingebe.

    Ausserdem erscheint, wenn ich https://URL eingebe, das css-File nicht. Der Rest schon. Bei Firefox wechselt es in

    Beim Startpunkt ist https angegeben.

    Im htaccess hab ichs mit verschiedenen Varianten (z.B. !on statt off) davon versucht:

    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


    Wenn das am Ende steht, geschieht gar nichts, d.h. die Site wird als http://URL angezeigt.

    Wenn das vor dem
    # Rewrite all other queries to the front controller.
    RewriteRule ^ %{ENV:BASE}/app.php [L]
    steht, kommt der Umleitungsfehler (zu viele Umleitungen).

    Ich benutze als Basis für die Site ein Theme von Rocksolid. Das Zertifikat ist ein LetsEncript-Ding, das woanders (Contao 3) prima läuft.

  10. #10
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Poste deine gesamte .htaccess, inkl. deiner RewriteRule.

  11. #11
    Contao-Fan Avatar von Marchie
    Registriert seit
    12.01.2012.
    Ort
    Schwaikheim
    Beiträge
    303

    Standard

    Hallo Hoch-3,
    mir wurde inzwischen geholfen und diese Schreibweise klappt bei mir in allen C4 Seiten. Wichtig ist, dass die Weiterleitung gleich am Anfang steht. Danach die anderen Weiterleitungen. Hier ein Auszug aus einer .htaccess:

    Code:
    <IfModule mod_rewrite.c>
        RewriteEngine On
    	
    	# non-www to www
    	RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
    	RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    	# force https
    	RewriteCond %{HTTPS} off
    	RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
       
        Redirect 301 /index.php/naturheilverfahren/akupunktur https://www.gesundheitundfamilie.com/behandlung/therapien.html

  12. #12
    Contao-Fan Avatar von Hoch-3
    Registriert seit
    16.11.2010.
    Ort
    Zürich
    Beiträge
    373
    Partner-ID
    7136

    Standard

    Danke schon mal.

    Leider auch hier "too many redirects". Auch wenn ich den ganzen Rest des .htaccess lösche. Und es ist das einzige .htaccess auf der Domain.

    Ausser... ich habe noch zwei urls als Alias eingerichtet. Dürfte aber kein Problem sein. Woanders funktioniert das auch (Contao 3.5).

    Ah, und wenn ich https://m-a-f.ch eingebe, erscheinen die CSS Daten nicht. Hat das mit der Base-URL zu tun? Wo kann man die setzen? Hab ich auch schon viel Zeit mit Suche verbracht, letzten Sonntag.

  13. #13
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Wie gesagt, poste deine .htaccess inkl. deinen eigenen Rewrites/Redirects.

  14. #14
    Contao-Fan Avatar von Hoch-3
    Registriert seit
    16.11.2010.
    Ort
    Zürich
    Beiträge
    373
    Partner-ID
    7136

    Standard

    Zitat Zitat von Spooky Beitrag anzeigen
    Wie gesagt, poste deine .htaccess inkl. deinen eigenen Rewrites/Redirects.

    Wenn ich das die ersten drei Zeilen auskommentiere, wie hier, dann findet es nicht alle Dateien, wenn ich https://m-a-f.ch eingebe. Die css und die js-Dateien fehlen. Im Base Href kommt die Adresse ohne https. In der Seitenstruktur bei der Startseite ist https verwenden angeklickt.

    Wenn ich die # weg mache, kommt too many redirects.


    Auf einer anderen Site, da hab ich das originale htacces, bei der Startseite das https angeklickt, kommt die Site trotzdem mit dem "unsicher"-Vermerk https://mavena.de

    Bei beiden unterschiedliche Hostings aber LetsEncript eingeschaltet.

    Die Weiterleitungen beim Hoster sind Serverbasierte Aliasse marcoferronato.ch ist die Hauptdomain, m-a-f.ch und noch eines die Aliasse.

    Code:
    # RewriteEngine On
    # RewriteCond %{HTTPS} = off
    # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
    
    
    <IfModule mod_headers.c>
        # Allow access from all domains for webfonts (see contao/core-bundle#528)
        <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        # Determine the RewriteBase automatically and set it as environment variable.
        # If you are using Apache aliases to do mass virtual hosting or installed the
        # project in a subdirectory, the base path will be prepended to allow proper
        # resolution of the app.php file and to redirect to the correct URI. It will
        # work in environments without path prefix as well, providing a safe, one-size
        # fits all solution. But as you do not need it in this case, you can comment
        # the following 2 lines to eliminate the overhead.
        RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]
    
        # Sets the HTTP_AUTHORIZATION header removed by Apache
        RewriteCond %{HTTP:Authorization} .
        RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
        # Redirect to URI without front controller to prevent duplicate content
        # (with and without `/app.php`). Only do this redirect on the initial
        # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
        # endless redirect loop (request -> rewrite to front controller ->
        # redirect -> request -> ...).
        # So in case you get a "too many redirects" error or you always get redirected
        # to the start page because your Apache does not expose the REDIRECT_STATUS
        # environment variable, you have 2 choices:
        # - disable this feature by commenting the following 2 lines or
        # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
        #   following RewriteCond (best solution)
        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
    
        # If the requested filename exists, simply serve it.
        # We only want to let Apache serve files and not directories.
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^ - [L]
    
        # Rewrite all other queries to the front controller.
        RewriteRule ^ %{ENV:BASE}/app.php [L]
      
      
        
        
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
            # When mod_rewrite is not available, we instruct a temporary redirect of
            # the start page to the front controller explicitly so that the website
            # and the generated links can still be used.
            RedirectMatch 302 ^/$ /app.php/
            # RedirectTemp cannot be used instead
        </IfModule>
    </IfModule>

  15. #15
    Contao-Urgestein
    Registriert seit
    20.09.2012.
    Ort
    Lüneburger Heide
    Beiträge
    1.976
    Partner-ID
    12207
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Hi,

    das hier ist eine aktuelle .htaccess aus Contao 3.5.35.
    Die Datei wurde um die Zeilen 232 bis 236 erweitert.

    Code:
    ##
    # This file is part of Contao.
    #
    # (c) Leo Feyer
    #
    # @license LGPL-3.0-or-later
    ##
    
    ##
    # Prevent access to the Contao template files
    ##
    <FilesMatch "\.(tpl|html5|xhtml)$">
      <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
      </IfModule>
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
    </FilesMatch>
    
    ##
    # Allow access from all domains for webfonts
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_headers.c>
      <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
        Header set Access-Control-Allow-Origin "*"
      </FilesMatch>
    </IfModule>
    
    ##
    # Disable ETags
    # @see http://developer.yahoo.com/performance/rules.html#etags
    ##
    FileETag None
    <IfModule mod_headers.c>
      Header unset ETag
    </IfModule>
    
    ##
    # Set the proper MIME types
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_mime.c>
      AddType application/javascript              js jsonp
      AddType application/json                    json
      AddType audio/ogg                           oga ogg
      AddType audio/mp4                           m4a f4a f4b
      AddType video/ogg                           ogv
      AddType video/mp4                           mp4 m4v f4v f4p
      AddType video/webm                          webm
      AddType video/x-flv                         flv
      AddType image/svg+xml                       svg svgz
      AddEncoding gzip                            svgz
      AddType application/vnd.ms-fontobject       eot
      AddType application/x-font-ttf              ttf ttc
      AddType font/opentype                       otf
      AddType application/x-font-woff             woff woff2
      AddType image/x-icon                        ico
      AddType image/webp                          webp
      AddType text/cache-manifest                 appcache manifest
      AddType text/x-component                    htc
      AddType application/xml                     rss atom xml rdf
      AddType application/x-web-app-manifest+json webapp
      AddType text/x-vcard                        vcf
      AddType application/x-shockwave-flash       swf
    </IfModule>
    
    ##
    # Gzip compression
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_deflate.c>
      <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
        AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
        AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
      </IfModule>
    </IfModule>
    
    ##
    # Expires headers (for better cache control)
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_expires.c>
      ExpiresActive on
    
      ##
      # Productional website
      ##
      ExpiresByType text/cache-manifest           "access plus 0 seconds"
      ExpiresByType text/html                     "access plus 0 seconds"
      ExpiresByType text/xml                      "access plus 0 seconds"
      ExpiresByType application/xml               "access plus 0 seconds"
      ExpiresByType application/json              "access plus 0 seconds"
      ExpiresByType application/rss+xml           "access plus 1 hour"
      ExpiresByType application/atom+xml          "access plus 1 hour"
      ExpiresByType image/gif                     "access plus 1 month"
      ExpiresByType image/png                     "access plus 1 month"
      ExpiresByType image/jpeg                    "access plus 1 month"
      ExpiresByType image/x-icon                  "access plus 1 month"
      ExpiresByType video/ogg                     "access plus 1 month"
      ExpiresByType audio/ogg                     "access plus 1 month"
      ExpiresByType video/mp4                     "access plus 1 month"
      ExpiresByType video/webm                    "access plus 1 month"
      ExpiresByType text/x-component              "access plus 1 month"
      ExpiresByType application/x-font-ttf        "access plus 1 month"
      ExpiresByType font/opentype                 "access plus 1 month"
      ExpiresByType application/x-font-woff       "access plus 1 month"
      ExpiresByType image/svg+xml                 "access plus 1 month"
      ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
      ExpiresByType text/css                      "access plus 1 year"
      ExpiresByType application/javascript        "access plus 1 year"
    
      ##
      # Disable caching during development
      # @see https://github.com/contao/core/issues/4364
      ##
      #ExpiresByType text/cache-manifest           "access"
      #ExpiresByType text/html                     "access"
      #ExpiresByType text/xml                      "access"
      #ExpiresByType application/xml               "access"
      #ExpiresByType application/json              "access"
      #ExpiresByType application/rss+xml           "access"
      #ExpiresByType application/atom+xml          "access"
      #ExpiresByType image/gif                     "access"
      #ExpiresByType image/png                     "access"
      #ExpiresByType image/jpeg                    "access"
      #ExpiresByType image/x-icon                  "access"
      #ExpiresByType video/ogg                     "access"
      #ExpiresByType audio/ogg                     "access"
      #ExpiresByType video/mp4                     "access"
      #ExpiresByType video/webm                    "access"
      #ExpiresByType text/x-component              "access"
      #ExpiresByType application/x-font-ttf        "access"
      #ExpiresByType font/opentype                 "access"
      #ExpiresByType application/x-font-woff       "access"
      #ExpiresByType image/svg+xml                 "access"
      #ExpiresByType application/vnd.ms-fontobject "access"
      #ExpiresByType text/css                      "access"
      #ExpiresByType application/javascript        "access"
    
    </IfModule>
    
    ##
    # Header adjustments
    ##
    <IfModule mod_headers.c>
    
      ##
      # Disable caching during development
      # @see https://github.com/contao/core/issues/4364
      ##
      #Header unset Cache-Control
      #Header append Cache-Control must-revalidate
    
      ##
      # Do not cache the cron.txt file
      # @see https://github.com/contao/core/issues/5105
      ##
      <FilesMatch "cron\.txt$">
        Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
      </FilesMatch>
    
      ##
      # Add a Vary Accept-Encoding header for the compressed resources. If you
      # modify the file types above, make sure to change them here accordingly.
      # @see http://developer.yahoo.com/performance/rules.html#gzip
      #
      # Note: If you are using a case-sensitive file system like HFS+ or ext4, you
      # have to change the <FilesMatch> directive as follows:
      #
      # <FilesMatch "\.(?i:js|css|xml|gz|svgz)$">
      #
      # For more information see: https://github.com/contao/core/issues/4364
      ##
      <FilesMatch "\.(js|css|xml|gz|svgz)$">
        Header append Vary Accept-Encoding
      </FilesMatch>
    
      ##
      # Do not cache source map files
      # @see https://github.com/contao/core/issues/8532
      ##
      <FilesMatch "\.map$">
        Header set Expires "0"
        Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
      </FilesMatch>
    
    </IfModule>
    
    ##
    # Disable MultiViews if you are having issues with requests returning the wrong
    # page. Requires AllowOverride Options=All,MultiViews to be set here.
    # @see https://github.com/contao/core/issues/3521
    ##
    #Options -MultiViews
    
    ##
    # URL rewriting
    ##
    <IfModule mod_rewrite.c>
      RewriteEngine On
    
      ##
      # Change the RewriteBase if your Contao installation is in a subdirectoy and
      # the rewrite rules are not working properly. Usage examples:
      #
      #   RewriteBase /contao-3.0.0
      #   RewriteBase /path/to/contao
      #
      # Depending on your server, you might have to remove the line entirely.
      ##
      RewriteBase /
    
      ##
      # Uncomment the following lines to add "www." to the domain:
      #
      #   RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
      #   RewriteRule (.*) http://www.example.com/$1 [R=301,L]
      #
      # Uncomment the following lines to remove "www." from the domain:
      #
      #   RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
      #   RewriteRule (.*) http://example.com/$1 [R=301,L]
      #
      # Make sure to replace "example.com" with your domain name.
      ##
        #Umleitung auf www und https
        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
        RewriteCond %{HTTPS} =off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
      ##
      # If you cannot use mod_deflate, uncomment the following lines to load a
      # compressed .gz version of the aggregated Contao JavaScript and CSS files.
      ##
      #AddEncoding gzip .gz
      #<FilesMatch "\.js\.gz$">
      #  AddType "application/javascript" .gz
      #</FilesMatch>
      #<FilesMatch "\.css\.gz$">
      #  AddType "text/css" .gz
      #</FilesMatch>
      #RewriteCond %{HTTP:Accept-encoding} gzip
      #RewriteCond %{REQUEST_FILENAME} \.(js|css)$
      #RewriteCond %{REQUEST_FILENAME}.gz -f
      #RewriteRule ^(.*)$ $1.gz [QSA,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 .*\.txt$ index.php [L]    # URL suffix .txt
      #   RewriteRule .*\.json$ index.php [L]   # URL suffix .json
      #
      # If you do not want to use an URL suffix at all, you have to add a third
      # line to prevent URLs that point to folders from being rewritten (see #4031).
      #
      #   RewriteCond %{REQUEST_FILENAME} !-d
      #   RewriteRule .* index.php [L]
      #
      # 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.
      ##
      RewriteCond %{REQUEST_FILENAME} !\.(htm|php|js|css|map|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|otf|tt[cf]|woff2?|svgz?|pdf|zip|gz)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .*\.html$ index.php [L]
    
      ##
      # The following rules are required if you want to pass the language as first
      # URL parameter (added in Contao 2.11). The first rule rewrites the empty URL
      # to the front end controller, the second one adds a missing trailing slash.
      ##
      RewriteRule ^[a-z]{2}(\-[A-Z]{2})?/$ index.php [L]
      RewriteRule ^([a-z]{2}(\-[A-Z]{2})?)$ $1/ [R=301,L]
    
    </IfModule>
    Hier noch mal der ergänzte Code:
    Code:
    #Umleitung auf www und https
        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
        RewriteCond %{HTTPS} =off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    Die Umleitung leitet auf www und https um und funktioniert bei Netcup und 1und1.

    Gruß
    tschero
    Autodidakt und HobbyWebdesigner

    www.webdesign24.biz
    Screencasts zu Contao

  16. #16
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Zitat Zitat von Hoch-3 Beitrag anzeigen
    Wenn ich das die ersten drei Zeilen auskommentiere, wie hier, dann findet es nicht alle Dateien, wenn ich https://m-a-f.ch eingebe. Die css und die js-Dateien fehlen. Im Base Href kommt die Adresse ohne https. In der Seitenstruktur bei der Startseite ist https verwenden angeklickt.
    Das liegt an deinem <base href>. Das hat nichts mit der .htaccess zu tun. Bist du hinter einem SSL Proxy?



    Außerdem solltest du lieber folgende .htaccess verwenden:
    Code:
    <IfModule mod_headers.c>
        # Allow access from all domains for webfonts (see contao/core-bundle#528)
        <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        # Force HTTPS
        RewriteCond %{HTTPS} off
        RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
        # Determine the RewriteBase automatically and set it as environment variable.
        # If you are using Apache aliases to do mass virtual hosting or installed the
        # project in a subdirectory, the base path will be prepended to allow proper
        # resolution of the app.php file and to redirect to the correct URI. It will
        # work in environments without path prefix as well, providing a safe, one-size
        # fits all solution. But as you do not need it in this case, you can comment
        # the following 2 lines to eliminate the overhead.
        RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]
    
        # Sets the HTTP_AUTHORIZATION header removed by Apache
        RewriteCond %{HTTP:Authorization} .
        RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
        # Redirect to URI without front controller to prevent duplicate content
        # (with and without `/app.php`). Only do this redirect on the initial
        # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
        # endless redirect loop (request -> rewrite to front controller ->
        # redirect -> request -> ...).
        # So in case you get a "too many redirects" error or you always get redirected
        # to the start page because your Apache does not expose the REDIRECT_STATUS
        # environment variable, you have 2 choices:
        # - disable this feature by commenting the following 2 lines or
        # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
        #   following RewriteCond (best solution)
        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
    
        # If the requested filename exists, simply serve it.
        # We only want to let Apache serve files and not directories.
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^ - [L]
    
        # Rewrite all other queries to the front controller.
        RewriteRule ^ %{ENV:BASE}/app.php [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
            # When mod_rewrite is not available, we instruct a temporary redirect of
            # the start page to the front controller explicitly so that the website
            # and the generated links can still be used.
            RedirectMatch 302 ^/$ /app.php/
            # RedirectTemp cannot be used instead
        </IfModule>
    </IfModule>

  17. #17
    Contao-Fan Avatar von Hoch-3
    Registriert seit
    16.11.2010.
    Ort
    Zürich
    Beiträge
    373
    Partner-ID
    7136

    Standard

    Zitat Zitat von Spooky Beitrag anzeigen
    Das liegt an deinem <base href>. Das hat nichts mit der .htaccess zu tun. Bist du hinter einem SSL Proxy?


    Danke herzlich. Sowas dachte ich mir. Ich habe aber keine Ahnung, wie sich die <base href> erstellt. Macht das nicht das Contao? Ich habe gesucht und gesucht und... nichts gefunden.

  18. #18
    Contao-Nutzer
    Registriert seit
    10.02.2012.
    Ort
    Basel
    Beiträge
    213
    Partner-ID
    8602

    Standard

    Zur Not kannst du das base-Tag im Template fe_page.html5 von Hand anpassen.

  19. #19
    Contao-Urgestein Avatar von do_while
    Registriert seit
    15.06.2009.
    Ort
    Berlin | Deutschland
    Beiträge
    3.612
    Partner-ID
    1081
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Tipp:
    Im "Startpunkt einer Webseite" gibt es eine Checkbox "HTTPS verwenden".
    Dann sollte sich der base-Tag entsprechend anpassen.

  20. #20
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Nein, der <base href> hat nichts mit der HTTPS Einstellung in der Seitenstruktur zu tun. Er sollte auch nicht selbst gesetzt oder geändert werden.

    Meine ursprüngliche Frage wurde nicht beantwortet.

  21. #21
    Contao-Nutzer
    Registriert seit
    10.02.2012.
    Ort
    Basel
    Beiträge
    213
    Partner-ID
    8602

    Standard Nebenbei...

    Zitat Zitat von Spooky Beitrag anzeigen
    Nein, der <base href> hat nichts mit der HTTPS Einstellung in der Seitenstruktur zu tun. Er sollte auch nicht selbst gesetzt oder geändert werden.
    Aus Interesse: Wo entscheidet Contao denn, ob das base-Tag mit https oder mit http ausgegeben wird?

  22. #22
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    PageRegular.php#500 » Environment.php#463 » Environment.php#335 » Hier kommt es nun darauf an, ob ein X-Forwarded-Host Header an den Server gesendet wurde und ob die Domain in diesem Header als "SSL Proxy Domain" in der Contao Config hinterlegt ist. Wenn ja, wird die URL mit https zurückgegeben. Wenn nein » Environment.php#318 » Symfony\Component\HttpFoundation\Request.php#1242 » Hier kommt es nun (unter Anderem) darauf an, ob die IP Adresse des Remote Hosts als "Trusted Proxy" hinterlegt ist. Wenn ja, wird weiter überprüft, ob der X-Forwarded-Proto Header Hinweise auf SSL enthält. Wenn ja wird zurückgegeben, dass SSL verwendet wird. Wenn nein, wird einfach überprüft, ob der Request selbst ein SSL Request ist.

    Daher auch die Frage mit dem Proxy. Wenn man sich hinter einem Proxy befindet, sei es ein Cache Proxy oder SSL Proxy, muss man seine Web Applikation entsprechend konfigurieren.

  23. #23
    Contao-Nutzer Avatar von RaLey
    Registriert seit
    24.11.2012.
    Ort
    Arnsberg
    Beiträge
    96
    Partner-ID
    9133

    Standard

    Ich habe gerade auch das Problem, dass der Base Href im Contao-Backend auf http anstatt https steht. In der .htaccess im /web-Verzeichnis habe ich per
    Code:
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    eine Weiterleitung im Frontend von http auf https erreichen können. Das Backend ist jedoch das große Problem, wo ich derzeit absolut auf dem Schlauch stehe und keine Lösung mehr finde. Hat jemand ggf. noch eine Idee?

    Danke schon mal im Voraus!

  24. #24
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Siehe die vorherigen Posts: du bist vermutlich hinter einem Proxy, der mit deinem eigentlichen Web Server nicht über SSL kommuniziert.

  25. #25
    Contao-Nutzer Avatar von RaLey
    Registriert seit
    24.11.2012.
    Ort
    Arnsberg
    Beiträge
    96
    Partner-ID
    9133

    Standard

    Ja, danke schon mal für die schnelle Antwort. Jedoch habe ich derzeit keine Ahnung, wie ich den base href (nur der Backend-Base-Href) nun korrekt ausgeben lassen kann. Any ideas?

  26. #26
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.062
    Partner-ID
    10107

    Standard

    Warum nur der Backend Base Href? Im Frontend sollte es ja auch falsch sein?

  27. #27
    Contao-Nutzer Avatar von RaLey
    Registriert seit
    24.11.2012.
    Ort
    Arnsberg
    Beiträge
    96
    Partner-ID
    9133

    Standard

    Ja, das ist das, was mich auch erstaunt )-;

  28. #28
    Alter Contao-Hase Avatar von kischd
    Registriert seit
    25.06.2009.
    Ort
    Karlsruhe
    Beiträge
    1.107

    Standard

    Auf meiner Site funktioniert die Umleitung auch nicht wie gewollt. (Contao 4.4.34)

    HTML-Code:
    <IfModule mod_headers.c>
        # Allow access from all domains for webfonts (see contao/core-bundle#528)
        <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        # Determine the RewriteBase automatically and set it as environment variable.
        # If you are using Apache aliases to do mass virtual hosting or installed the
        # project in a subdirectory, the base path will be prepended to allow proper
        # resolution of the app.php file and to redirect to the correct URI. It will
        # work in environments without path prefix as well, providing a safe, one-size
        # fits all solution. But as you do not need it in this case, you can comment
        # the following 2 lines to eliminate the overhead.
        RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]
    
        # Sets the HTTP_AUTHORIZATION header removed by Apache
        RewriteCond %{HTTP:Authorization} .
        RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
        # Redirect to URI without front controller to prevent duplicate content
        # (with and without `/app.php`). Only do this redirect on the initial
        # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
        # endless redirect loop (request -> rewrite to front controller ->
        # redirect -> request -> ...).
        # So in case you get a "too many redirects" error or you always get redirected
        # to the start page because your Apache does not expose the REDIRECT_STATUS
        # environment variable, you have 2 choices:
        # - disable this feature by commenting the following 2 lines or
        # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
        #   following RewriteCond (best solution)
        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
    
        # If the requested filename exists, simply serve it.
        # We only want to let Apache serve files and not directories.
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^ - [L]
    
        # Rewrite all other queries to the front controller.
        RewriteRule ^ %{ENV:BASE}/app.php [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
            # When mod_rewrite is not available, we instruct a temporary redirect of
            # the start page to the front controller explicitly so that the website
            # and the generated links can still be used.
            RedirectMatch 302 ^/$ /app.php/
            # RedirectTemp cannot be used instead
        </IfModule>
    </IfModule>
    
    
    
    ##
    # Prevent access to the Contao template files
    ##
    <FilesMatch "\.(tpl|html5|xhtml)$">
      <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
      </IfModule>
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
    </FilesMatch>
    
    ##
    # Allow access from all domains for webfonts
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_headers.c>
      <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
        Header set Access-Control-Allow-Origin "*"
      </FilesMatch>
    </IfModule>
    
    ##
    # Disable ETags
    # @see http://developer.yahoo.com/performance/rules.html#etags
    ##
    FileETag None
    <IfModule mod_headers.c>
      Header unset ETag
    </IfModule>
    
    ##
    # Set the proper MIME types
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_mime.c>
      AddType application/javascript              js jsonp
      AddType application/json                    json
      AddType audio/ogg                           oga ogg
      AddType audio/mp4                           m4a f4a f4b
      AddType video/ogg                           ogv
      AddType video/mp4                           mp4 m4v f4v f4p
      AddType video/webm                          webm
      AddType video/x-flv                         flv
      AddType image/svg+xml                       svg svgz
      AddEncoding gzip                            svgz
      AddType application/vnd.ms-fontobject       eot
      AddType application/x-font-ttf              ttf ttc
      AddType font/opentype                       otf
      AddType application/x-font-woff             woff woff2
      AddType image/x-icon                        ico
      AddType image/webp                          webp
      AddType text/cache-manifest                 appcache manifest
      AddType text/x-component                    htc
      AddType application/xml                     rss atom xml rdf
      AddType application/x-web-app-manifest+json webapp
      AddType text/x-vcard                        vcf
      AddType application/x-shockwave-flash       swf
    </IfModule>
    
    ##
    # Gzip compression
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_deflate.c>
      #<IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
        AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
        AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
      #</IfModule>
    </IfModule>
    
    ##
    # Expires headers (for better cache control)
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_expires.c>
      ExpiresActive on
    
      ##
      # Productional website
      ##
      ExpiresByType text/cache-manifest           "access plus 0 seconds"
      ExpiresByType text/html                     "access plus 0 seconds"
      ExpiresByType text/xml                      "access plus 0 seconds"
      ExpiresByType application/xml               "access plus 0 seconds"
      ExpiresByType application/json              "access plus 0 seconds"
      ExpiresByType application/rss+xml           "access plus 1 hour"
      ExpiresByType application/atom+xml          "access plus 1 hour"
      ExpiresByType image/gif                     "access plus 1 month"
      ExpiresByType image/png                     "access plus 1 month"
      ExpiresByType image/jpeg                    "access plus 1 month"
      ExpiresByType image/x-icon                  "access plus 1 month"
      ExpiresByType video/ogg                     "access plus 1 month"
      ExpiresByType audio/ogg                     "access plus 1 month"
      ExpiresByType video/mp4                     "access plus 1 month"
      ExpiresByType video/webm                    "access plus 1 month"
      ExpiresByType text/x-component              "access plus 1 month"
      ExpiresByType application/x-font-ttf        "access plus 1 month"
      ExpiresByType font/opentype                 "access plus 1 month"
      ExpiresByType application/x-font-woff       "access plus 1 month"
      ExpiresByType image/svg+xml                 "access plus 1 month"
      ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
      ExpiresByType text/css                      "access plus 1 year"
      ExpiresByType application/javascript        "access plus 1 year"
    
      ##
      # Disable caching during development
      # @see https://github.com/contao/core/issues/4364
      ##
      #ExpiresByType text/cache-manifest           "access"
      #ExpiresByType text/html                     "access"
      #ExpiresByType text/xml                      "access"
      #ExpiresByType application/xml               "access"
      #ExpiresByType application/json              "access"
      #ExpiresByType application/rss+xml           "access"
      #ExpiresByType application/atom+xml          "access"
      #ExpiresByType image/gif                     "access"
      #ExpiresByType image/png                     "access"
      #ExpiresByType image/jpeg                    "access"
      #ExpiresByType image/x-icon                  "access"
      #ExpiresByType video/ogg                     "access"
      #ExpiresByType audio/ogg                     "access"
      #ExpiresByType video/mp4                     "access"
      #ExpiresByType video/webm                    "access"
      #ExpiresByType text/x-component              "access"
      #ExpiresByType application/x-font-ttf        "access"
      #ExpiresByType font/opentype                 "access"
      #ExpiresByType application/x-font-woff       "access"
      #ExpiresByType image/svg+xml                 "access"
      #ExpiresByType application/vnd.ms-fontobject "access"
      #ExpiresByType text/css                      "access"
      #ExpiresByType application/javascript        "access"
    
    </IfModule>
    
    ##
    # Header adjustments
    ##
    <IfModule mod_headers.c>
    
      ##
      # Disable caching during development
      # @see https://github.com/contao/core/issues/4364
      ##
      #Header unset Cache-Control
      #Header append Cache-Control must-revalidate
    
      ##
      # Do not cache the cron.txt file
      # @see https://github.com/contao/core/issues/5105
      ##
      <FilesMatch "cron\.txt$">
        Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
      </FilesMatch>
    
      ##
      # Add a Vary Accept-Encoding header for the compressed resources. If you
      # modify the file types above, make sure to change them here accordingly.
      # @see http://developer.yahoo.com/performance/rules.html#gzip
      #
      # Note: If you are using a case-sensitive file system like HFS+ or ext4, you
      # have to change the <FilesMatch> directive as follows:
      #
      # <FilesMatch "\.(?i:js|css|xml|gz|svgz)$">
      #
      # For more information see: https://github.com/contao/core/issues/4364
      ##
      <FilesMatch "\.(js|css|xml|gz|svgz)$">
        Header append Vary Accept-Encoding
      </FilesMatch>
    
    </IfModule>
    
    ##
    # Disable MultiViews if you are having issues with requests returning the wrong
    # page. Requires AllowOverride Options=All,MultiViews to be set here.
    # @see https://github.com/contao/core/issues/3521
    ##
    #Options -MultiViews
    
    ##
    # URL rewriting
    ##
    <IfModule mod_rewrite.c>
      RewriteEngine On
    
      ##
      # Change the RewriteBase if your Contao installation is in a subdirectoy and
      # the rewrite rules are not working properly. Usage examples:
      #
      #   RewriteBase /contao-3.0.0
      #   RewriteBase /path/to/contao
      #
      # Depending on your server, you might have to remove the line entirely.
      ##
      RewriteBase /
    
      ##
      # Uncomment the following lines to add "www." to the domain:
      #
      #   RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
      #   RewriteRule (.*) http://www.example.com/$1 [R=301,L]
      #
      # Uncomment the following lines to remove "www." from the domain:
      #
      #   RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
      #   RewriteRule (.*) http://example.com/$1 [R=301,L]
      #
      # Make sure to replace "example.com" with your domain name.
      ##
    
      
    
      
      RewriteCond %{HTTP_HOST} ^sailactive\.com [NC]
      RewriteRule (.*) https://www.sailactive.com/$1 [R=301,L]
      
      
      
      RewriteCond %{HTTPS} off
      RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
      #Header set Strict-Transport-Security: "max-age=63072000; includeSubDomains; preload"
      
    
      
      
      ##
      # If you cannot use mod_deflate, uncomment the following lines to load a
      # compressed .gz version of the aggregated Contao JavaScript and CSS files.
      ##
      #AddEncoding gzip .gz
      #<FilesMatch "\.js\.gz$">
      #  AddType "application/javascript" .gz
      #</FilesMatch>
      #<FilesMatch "\.css\.gz$">
      #  AddType "text/css" .gz
      #</FilesMatch>
      #RewriteCond %{HTTP:Accept-encoding} gzip
      #RewriteCond %{REQUEST_FILENAME} \.(js|css)$
      #RewriteCond %{REQUEST_FILENAME}.gz -f
      #RewriteRule ^(.*)$ $1.gz [QSA,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 .*\.txt$ index.php [L]    # URL suffix .txt
      #   RewriteRule .*\.json$ index.php [L]   # URL suffix .json
      #
      # If you do not want to use an URL suffix at all, you have to add a third
      # line to prevent URLs that point to folders from being rewritten (see #4031).
      #
      #   RewriteCond %{REQUEST_FILENAME} !-d
      #   RewriteRule .* index.php [L]
      #
      # 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.
      ##
      RewriteCond %{REQUEST_FILENAME} !\.(htm|php|js|css|map|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|otf|tt[cf]|woff2?|svgz?|pdf|gz)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .*\.html$ index.php [L]
    
      ##
      # The following rules are required if you want to pass the language as first
      # URL parameter (added in Contao 2.11). The first rule rewrites the empty URL
      # to the front end controller, the second one adds a missing trailing slash.
      ##
      RewriteRule ^[a-z]{2}(\-[A-Z]{2})?/$ index.php [L]
      RewriteRule ^([a-z]{2}(\-[A-Z]{2})?)$ $1/ [R=301,L]
    
    </IfModule>
    
    
    
    
    ErrorDocument 403 /index.php
    ErrorDocument 404 /index.php

    es zieht komischerweise gar nichts. Die htaccess liegt im web-Ordner.

    wenn ich der URL https:\\ weglösche bleibt er auch ohne
    Gruß Mark

  29. #29
    Alter Contao-Hase Avatar von kischd
    Registriert seit
    25.06.2009.
    Ort
    Karlsruhe
    Beiträge
    1.107

    Standard

    ohne den Anfangspart hatte ich das in der 3.5-Installation benutzt
    Gruß Mark

  30. #30
    Alter Contao-Hase Avatar von kischd
    Registriert seit
    25.06.2009.
    Ort
    Karlsruhe
    Beiträge
    1.107

    Standard

    Habe mal radikal reduziert...
    zack es geht.
    Ist beim alten Schinken etwas dabei was dem System nicht schmeckt?

    HTML-Code:
    <IfModule mod_headers.c>
        # Allow access from all domains for webfonts (see contao/core-bundle#528)
        <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        # Determine the RewriteBase automatically and set it as environment variable.
        # If you are using Apache aliases to do mass virtual hosting or installed the
        # project in a subdirectory, the base path will be prepended to allow proper
        # resolution of the app.php file and to redirect to the correct URI. It will
        # work in environments without path prefix as well, providing a safe, one-size
        # fits all solution. But as you do not need it in this case, you can comment
        # the following 2 lines to eliminate the overhead.
        RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]
    
        # Sets the HTTP_AUTHORIZATION header removed by Apache
        RewriteCond %{HTTP:Authorization} .
        RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    	 
      RewriteCond %{HTTP_HOST} ^sailactive\.com [NC]
      RewriteRule (.*) https://www.sailactive.com/$1 [R=301,L]
      
     
      RewriteCond %{HTTPS} off
      RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
      #Header set Strict-Transport-Security: "max-age=63072000; includeSubDomains; preload"
    
    	
    	#
    	# Make sure to replace "example.com" with your domain name.
    
        # Redirect to URI without front controller to prevent duplicate content
        # (with and without `/app.php`). Only do this redirect on the initial
        # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
        # endless redirect loop (request -> rewrite to front controller ->
        # redirect -> request -> ...).
        # So in case you get a "too many redirects" error or you always get redirected
        # to the start page because your Apache does not expose the REDIRECT_STATUS
        # environment variable, you have 2 choices:
        # - disable this feature by commenting the following 2 lines or
        # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
        #   following RewriteCond (best solution)
        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
    
        # If the requested filename exists, simply serve it.
        # We only want to let Apache serve files and not directories.
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^ - [L]
    
        # Rewrite all other queries to the front controller.
        RewriteRule ^ %{ENV:BASE}/app.php [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
            # When mod_rewrite is not available, we instruct a temporary redirect of
            # the start page to the front controller explicitly so that the website
            # and the generated links can still be used.
            RedirectMatch 302 ^/$ /app.php/
            # RedirectTemp cannot be used instead
        </IfModule>
    </IfModule>
    
    ErrorDocument 403 /index.php
    ErrorDocument 404 /index.php
    Gruß Mark

  31. #31
    Contao-Fan Avatar von Anke
    Registriert seit
    30.06.2009.
    Ort
    Rhein-Main-Gebiet
    Beiträge
    919

    Standard https-Aktivierung in der Seitenstruktur nur fürs Frontend?

    Hallöchen!

    Wenn ich bei DomainFactory ein Domain-Zertifikat beantrage, gilt dies - in der Regel - für mit und ohne www.
    Wenn ich bei originärer htaccess in der Seitenstruktur https aktiviere, wird das Frontend beim Aufruf der Domain mit und ohne www automatisch auf https umgeleitet, das Backend aber nicht.
    Warum ist das so? Und wie erfährt man heutzutage bei Updates über den Contao-Manager, ob sich die htaccess geändert hat? Muss man jedes Mal checen, ob eine .htaccess.default oder sowas dazu gekommen ist?

    Grüße,
    Anke

  32. #32
    Community-Moderatorin & Contao-Urgestein Avatar von mlweb
    Registriert seit
    10.07.2011.
    Beiträge
    6.742
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Zitat Zitat von Anke Beitrag anzeigen
    Und wie erfährt man heutzutage bei Updates über den Contao-Manager, ob sich die htaccess geändert hat? Muss man jedes Mal checen, ob eine .htaccess.default oder sowas dazu gekommen ist?
    Genauso wie bei den Templates vergleiche ich einfach die Dateien.
    Ich habe Dir mit meinen Hinweisen geholfen und Du möchtest Dich bedanken?
    Unterstütze bitte das Contao-Projekt (Button Links)
    Weitere Spendenmöglichkeiten
    ------------------------------------------------------------------------------------------------------
    Contao-Dokumentation: Contao-Handbuch und Contao-Entwickler-Doku
    Contao-Online-Video-Kurse: Contao Academy
    Funktionalität erweitern: Contao-Erweiterungen

    Für Dinge die man mit html5 und css3 lösen kann, braucht man kein javascript.




  33. #33
    Contao-Fan Avatar von Anke
    Registriert seit
    30.06.2009.
    Ort
    Rhein-Main-Gebiet
    Beiträge
    919

    Standard

    Zitat Zitat von mlweb Beitrag anzeigen
    Genauso wie bei den Templates vergleiche ich einfach die Dateien.
    Ein enormer Fortschritt ...

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
  •