Ergebnis 1 bis 9 von 9

Thema: Contao 4 .htaccess

  1. #1
    Contao-Urgestein Avatar von Franko
    Registriert seit
    22.06.2009.
    Beiträge
    1.503
    Partner-ID
    6122

    Standard Contao 4 .htaccess

    Hallo,
    teste die neue 4.0.2 - soweit ich verstanden habe wurde hier ja auf .htacess Dateien verzichtet damit man unabhängig vom Apache wird.

    Wie ist das jetzt aber mit der mitgelieferten .htacess im "web" Verzeichnis.
    Die ist gegenüber der bisherigen Versionen ja recht abgespeckt.

    Kann man da die bisherigen Einträge wieder hinzufügen oder muß das in ein anderes Verzeichnis ...?

    Danke
    Franko
    Freelancer, Digital Design Enthusiast, Contao Aficionado and Tutorial Junkie @MoinFranko - Carpe diem ...

  2. #2
    Wandelndes Contao-Lexikon Avatar von BugBuster
    Registriert seit
    15.06.2009.
    Ort
    Berlin
    Beiträge
    10.512
    User beschenken
    Wunschliste

    Standard

    Die 4.0.2 bring eine .htaccess mit, liegt im /web Verzeichnis.
    Die weiteren .htaccess Dateien die es sonst noch so gab in anderen Verzeichnissen sind nun aber nicht mehr nötig.

    Was fehlt dir denn in der mitgeliefgerten?
    Grüße, BugBuster
    "view source" is your guide.
    Danke an alle Amazon Wunschlisten Erfüller

  3. #3
    Contao-Urgestein Avatar von Franko
    Registriert seit
    22.06.2009.
    Beiträge
    1.503
    Partner-ID
    6122

    Standard

    Zitat Zitat von BugBuster Beitrag anzeigen
    Was fehlt dir denn in der mitgeliefgerten?
    Hm,
    also in meiner steht "nur":
    Code:
    # Use the front controller as index file. It serves as a fallback solution when
    # every other rewrite/redirect fails (e.g. in an aliased environment without
    # mod_rewrite). Additionally, this reduces the matching process for the
    # start page (path "/") because otherwise Apache will apply the rewriting rules
    # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
    DirectoryIndex app.php
    
    # Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
    # to the front controller "/app.php" but be rewritten to "/app.php/app".
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </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}/$2 [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>
    In der 3.5 beispielsweise ( Auszug ... ):
    Code:
    ##
    # 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>
    
    usw...
    Freelancer, Digital Design Enthusiast, Contao Aficionado and Tutorial Junkie @MoinFranko - Carpe diem ...

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

    Standard

    Hm, ich frage mich auch, warum sachen wie
    • Disable ETags
    • MIME types
    • Gzip compression
    • Expires headers
    in der mitgelieferten .htaccess fehlen.

  5. #5
    Wandelndes Contao-Lexikon Avatar von BugBuster
    Registriert seit
    15.06.2009.
    Ort
    Berlin
    Beiträge
    10.512
    User beschenken
    Wunschliste

    Standard

    Nun, es wurde die .htaccess von Symfony übernommen
    https://github.com/symfony/symfony-d.../web/.htaccess
    Meht hat die auch nicht.
    Wer mehr will, muss wohl selber Hand anlegen, aus reiner Symfony Sicht wohl auch OK so.
    Aus CMS Sicht könnte man natürlich hier mehr reinpacken.
    Grüße, BugBuster
    "view source" is your guide.
    Danke an alle Amazon Wunschlisten Erfüller

  6. #6
    Contao-Fan Avatar von k-webdesign
    Registriert seit
    07.06.2010.
    Ort
    Karlsruhe
    Beiträge
    648
    Partner-ID
    5911
    User beschenken
    Wunschliste

    Standard

    Könnte man die "alte" 3.5er .htaccess einfach übernehmen oder sind da manche Dinge obsolet?

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

    Standard

    1:1 übernehmen kannst und solltest du sie nicht. Wenn dann nur spezifische Dinge.

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

    Support Contao

    Standard

    Nina hatte da etwas geschrieben, wo ich mich letztens auch bedient habe.
    https://community.contao.org/de/show...l=1#post438350
    siehe auch meine Anmerkung dazu weiter unten und @Spookys Antwort.
    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.




  9. #9
    Contao-Nutzer Avatar von rflx
    Registriert seit
    06.08.2009.
    Ort
    127.0.0.1
    Beiträge
    98

    Standard

    Bei HTML5 Boilerplate findet man eine Vielzahl an Einträgen um die Contao 4 .htaccess zu erweitern.


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
  •