Ergebnis 1 bis 13 von 13

Thema: Installation im Unterverzeichnis & Sprachenwechsler | .htaccess ändern?

  1. #1
    Contao-Fan Avatar von electricarts
    Registriert seit
    22.07.2010.
    Ort
    Georgsmarienhütte
    Beiträge
    381

    Standard Installation im Unterverzeichnis & Sprachenwechsler | .htaccess ändern?

    Hallo,

    ich habe Contao in einem Unterverzeichnis (contao) installiert und die .htaccess im Wurzelverzeichnis entsprechend der Anleitung im Wiki angepasst. Es ist außerdem der Sprachenwechsler installiert. Funktioniert soweit alles. Nur komme ich nun nicht mehr ins Backend. Der Aufruf von www.xyz.de/contao landet auf www.xyz.de/de/contao/. Das geht dann natürlich nicht („The requested URL /contao/de/contao/ was not found on this server“).

    Ich muss doch bestimmt in der .htaccess noch etwas ändern um wieder ins BE zu kommen, oder?

    Viele Grüße


    Mario

  2. #2
    Contao-Nutzer
    Registriert seit
    01.11.2012.
    Ort
    Kiel
    Beiträge
    109

    Standard

    Moin Mario,

    poste bitte einmal den Inhalt der beiden .htaccess-Dateien (eine liegt im Root, eine im Ordner /contao). Vielleicht lässt sich daran ein Fehler feststellen.

  3. #3
    Contao-Fan Avatar von electricarts
    Registriert seit
    22.07.2010.
    Ort
    Georgsmarienhütte
    Beiträge
    381

    Standard

    Hallo Martin,

    here we go …

    Root:

    Code:
    RewriteEngine On
     RewriteBase /
     
     # Contao Regeln (Start)
     RewriteCond %{REQUEST_URI} (ftp|https?):|/etc/ [NC,OR]
     RewriteCond %{QUERY_STRING} (ftp|https?):|/etc/ [NC]
     RewriteRule .* - [F,L]
     # Contao Regeln (End)
     
     RewriteCond %{REQUEST_URI} !^contao/.*
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d [OR]
     RewriteCond %{REQUEST_URI} ^/$
     
     RewriteRule ^(.*) /contao/$1 [L]
    Contao:

    Code:
    ##
    # 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 /
    Viele Grüße


    Mario

  4. #4
    Contao-Nutzer
    Registriert seit
    01.11.2012.
    Ort
    Kiel
    Beiträge
    109

    Standard

    Moin Mario,

    sorry für die späte Rückmeldung. Ist dort beim Einfügen der zweiten .htaccess (die aus dem Ordner /contao) etwas verloren gegangen, oder ist die wirklich so kurz? Denn darin steht keine RewriteRule, d.h. es wird auch nichts umgeschrieben.

  5. #5
    Contao-Fan Avatar von electricarts
    Registriert seit
    22.07.2010.
    Ort
    Georgsmarienhütte
    Beiträge
    381

    Standard

    Hallo Martin,

    den „Rest“ habe ich weggelassen :

    Code:
     ##
      # Uncomment to redirect domains without "www" to the "www" subdomain.
      ##
      #RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
      #RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
      ##
      # Uncomment to redirect domains with "www" to the empty domain.
      ##
      #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
      #RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
    Da habe ich nichts dran geändert.


    Viele Grüße


    Mario

  6. #6
    Contao-Nutzer
    Registriert seit
    01.11.2012.
    Ort
    Kiel
    Beiträge
    109

    Standard

    Naja, zumindest fehlt dort das schliessende "</IfModule>".

    Bevor ich hier weiter rumrate, poste doch bitte die kompletten .htaccess-Dateien, oder hänge sie an einen Beitrag an. Also nicht nur den Teil mit den RewriteRules, sondern alles. Wenn dort Domainnamen o.ä. drinstehen, kannst du sie natürlich anonymisieren.

  7. #7
    Contao-Fan Avatar von electricarts
    Registriert seit
    22.07.2010.
    Ort
    Georgsmarienhütte
    Beiträge
    381

    Standard

    Die erste (also die im root Verzeichnis) ist komplett. Die zweite (Contao) ist unverändert wie sie aus dem Paket kommt. Also so:

    Code:
    ##
    # Contao Open Source CMS
    # 
    # Copyright (C) 2005-2012 Leo Feyer
    # 
    # @package Core
    # @link    http://contao.org
    # @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
    ##
    
    ##
    # Prevent access to the Contao template files
    ##
    <FilesMatch "\.(tpl|html5|xhtml)$">
      Order allow,deny
      Deny from all
    </FilesMatch>
    
    ##
    # Allow access from all domains for webfonts
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_headers.c>
      <FilesMatch "\.(ttf|ttc|otf|eot|woff|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
      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>
    
    ##
    # Disable caching during development
    # @see https://github.com/contao/core/issues/4364
    ##
    #<IfModule mod_headers.c>
    #  Header unset Cache-Control
    #  Header append Cache-Control must-revalidate
    #</IfModule>
    
    ##
    # 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)$">
    #
    # For more information see: https://github.com/contao/core/issues/4364
    ##
    <IfModule mod_headers.c>
      <FilesMatch "\.(js|css|xml|gz)$">
        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 to redirect domains without "www" to the "www" subdomain.
      ##
      #RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
      #RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
      ##
      # Uncomment to redirect domains with "www" to the empty domain.
      ##
      #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
      #RewriteRule ^ http://%1%{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 "text/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]
    
      ##
      # Do not rewrite requests for static files or folders such as style sheets,
      # images, movies or text documents. Do not add the URL suffix here!
      #
      # 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:htm|php|js|css| … |gz)$">
      #
      # For more information see: https://github.com/contao/core/issues/4364
      ##
      <FilesMatch "\.(htm|php|js|css|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|eot|woff|svg|ttf|pdf|gz)$">
        RewriteEngine Off
      </FilesMatch>
    
      ##
      # 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 second
      # 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} !-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 an empty URL
      # to the front end controller, the second one adds a missing trailing slash.
      ##
      RewriteRule ^[a-z]{2}/$ index.php [L]
      RewriteRule ^([a-z]{2})$ $1/ [R=301,L]
    
    </IfModule>
    Viele Grüße


    Mario

  8. #8
    bridget
    Gast

    Standard

    Hui, Beitrag wieder gefunden. Jetzt habe ich wohl ein Doppelposting eröffnet Sorry dafür.

    https://community.contao.org/de/show...L-amp-htaccess

    Wie habt ihr denn das Problem gelöst?

    lg mel

  9. #9
    Contao-Fan Avatar von electricarts
    Registriert seit
    22.07.2010.
    Ort
    Georgsmarienhütte
    Beiträge
    381

    Standard

    Hi Mel,

    ich habe nun vom Server-Admin die Möglichkeit bekommen das Dokumentenroot-Verzeichnis für die Domain zu ändern. Somit brauche ich nicht mit der .htaccess rumspielen und kann alles so belassen wie es ohne Installation im Unterverzeichnis wäre. Interessieren würde mich eine funktionierende Lösung mittels .htaccess aber auch. Braucht man ja vielleicht später noch mal.

    Bei welchem Hoster bist Du denn? Kann man dort nicht auch das Dokumentenroot-Verzeichnis anpassen?

    Viele Grüße


    Mario

  10. #10
    bridget
    Gast

    Standard

    Hallo Mario,

    wir sind bei Host Europe. Leider kann man da meines Wissens nur über einen Unterordner gehen. Aber das haben doch ganz viele, muss es doch eine Lösung geben. Ich denke wirklich das es bei mir "nur" eine falsche Zeile oder so ist.

    Ich weiss auch nicht genau, ob es eine Rolle spielt, das ich die htaccess von Contao 11.5 statt 11.4 habe (die habe irgendwie gelöscht und leider nicht den Original-Zip-Ordner)

    So ist das halt, wenn einem schon die Basics fehlen, aber irgendwie muss man ja lernen.

    Aber vielen Dank für Deine Meldung!

    lg mel

  11. #11
    Contao-Fan Avatar von electricarts
    Registriert seit
    22.07.2010.
    Ort
    Georgsmarienhütte
    Beiträge
    381

    Standard

    Also ich habe das jetzt bei mehreren Hostern gesehen. Dort kann man über das Webinterface die Domain auf ein bestimmtes Verzeichnis routen. Ich kann mir nicht vorstellen, dass Host Europa das nicht unterstützt. Schau doch einfach mal nach. Das wäre die einfachste Lösung.


    Viele Grüße


    Mario

  12. #12
    Administrator Avatar von hofff
    Registriert seit
    02.06.2011.
    Beiträge
    846
    User beschenken
    Wunschliste

    Standard Installation im Unterverzeichnis & Sprachenwechsler | .htaccess ändern?

    Hallo,

    mit dem Ändern des DNS-Eintrages auf das jeweilige Verzeichnis ist auch sinnvoller, denn bei umfangreicheren Websites kann die htaccess-Methode schon mal ein bissl Zeit und Serverlast beanspruchen! Bei hosteurope geht das definitiv auch! :-)


    fg
    nicky

    ... von meinem iPhone mit Tapatalk gesendet!
    ... alles wird besser!

    Präsident der Contao Association Website/Github | Mitglied der Contao Community Alliance Website/Github

    individuelle Webanwendungen, Erweiterungen und noch viel mehr ... www.hofff.com/Github

  13. #13
    bridget
    Gast

    Standard

    Wah, wie verpeilt bin ich denn Verweis, DNS-Eintrag. Ich war irgendwie ganz wo anders

    Jetzt hat alles geklappt. Lieben Dank dafür

    mel

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
  •