Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?

    wood4u

    • Neu im Forum
    • Beiträge: 31
    Guten Tag,

    mein Shop habe ich in einem Unterverzeichniss /shop
    Jetzt habe ich ein Blog eingerichtet im Unterverzeichniss /blog
    Jetzt werde ich immer auf www.domain.de/shop umgeleitet wenn ich auf www.domain.de/blog zugreifen möchte.
    Ich vermute das liegt an der .htaccess?

    Kann mir jemand weiter helfen?

    Danke und Grüße

    Linkback: https://www.modified-shop.org/forum/index.php?topic=29753.0

    burrito

    • Viel Schreiber
    • Beiträge: 535
    • Geschlecht:
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #1 am: 23. März 2014, 14:19:02
    Es kann auch sein, dass Du deinen Web-Space so konfiguriert hast, dass Zugriffe auf www.example.com nach www.example.com/shop umgeleitet werden. Dann wird die Umleitung nicht von der .htaccess durchgeführt.

    Für weitere Hilfen ist es hilfreich, wenn Du Deine .htaccess hier postest.

    burrito

    wood4u

    • Neu im Forum
    • Beiträge: 31
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #2 am: 23. März 2014, 14:28:12
    Hallo Burrito,

    Danke für deine Antwort.
    Ich poste mal meine .htaccess

    Eine .htacces liegt im shoproot und eine im Unterverzeichniss /shop
    Sollte das eigentlich so sein?

    Wenn ich die .htaccess im Shoproot lösche ist die Seite ohne www. nicht mehr erreichbar.

    .htacces im root:
    Code: PHP  [Auswählen]
    # $Id: .htaccess,v 1.5 2005/05/19 17:09:19 Administrator Exp $
    #
    # This is used with Apache WebServers
    #
    # For this to work, you must include the parameter 'Options' to
    # the AllowOverride configuration
    #
    # Example:
    #
    #<Directory "/usr/local/apache/htdocs">
    #   AllowOverride Options
    #</Directory>
    #
    # 'All' with also work. (This configuration is in the
    # apache/conf/httpd.conf file)
    # The following makes adjustments to the SSL protocol for Internet
    # Explorer browsers
    <IfModule mod_setenvif.c>
      <IfDefine SSL>
        SetEnvIf User-Agent ".*MSIE.*" \
                 nokeepalive ssl-unclean-shutdown \
                 downgrade-1.0 force-response-1.0
      </IfDefine>
    </IfModule>

    # Fix certain PHP values
    # (commented out by default to prevent errors occuring on certain
    # servers)
    #<IfModule mod_php4.c>
    #  php_value session.use_trans_sid 0
    #  php_value register_globals 1
    #</IfModule>

    #-- set expire header for image, pdf, js and css files for 30 days
    #<FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|js|css)$" >
    #  Header set Cache-Control "max-age=2592000, public"
    #</FilesMatch>

    #-- Turn off ETags in HTTP-header
    #FileETag None

    #-- Call time pass reference error ?!
    #php_flag  allow_call_time_pass_reference On

    #-- XTC Session only on first visit
    #php_flag session.use_trans_sid 0

    #-----------------------------------------
    #- SEO Hartmut König
    #-----------------------------------------
    #-- ! Comment this line, if you get an ERROR 500 !
    #Options +FollowSymlinks

    # http://httpd.apache.org/docs/misc/rewriteguide.html
    RewriteEngine on

    #-- Sitemap
    RewriteRule ^sitemap(.*)\.html$ /shop_content.php?coID=8 [qsappend,L]

    ##-- Kategorien
    RewriteCond %{REQUEST_URI} (.*):::([_0-9]+):([_0-9]+)\.html$
    RewriteRule (.*):::([_0-9]+):([_0-9]+)\.html$ /index.php?cPath=$2&page=$3 [qsappend,L]
    RewriteCond %{REQUEST_URI} (.*):::([_0-9]+)\.html$
    RewriteRule (.*):::([_0-9]+)\.html$ /index.php?cPath=$2 [qsappend,L]

    ##-- Produkte
    RewriteRule (.*)::(.+)\.html$ /product_info.php?products_id=$2 [qsappend,L]

    ##-- Content
    RewriteRule (.*):_:([0-9]+)\.html$ /shop_content.php?coID=$2 [qsappend,L]

    ##-- Manufacturers
    RewriteCond %{REQUEST_URI} (.*):.:([_0-9]+):([_0-9]+)\.html$
    RewriteRule (.*):.:([_0-9]+):([_0-9]+)\.html$ /index.php?manufacturers_id=$2&page=$3 [qsappend,L]
    RewriteCond %{REQUEST_URI} (.*):.:([_0-9]+)\.html$
    RewriteRule (.*):.:([0-9]+)\.html$ /index.php?manufacturers_id=$2 [qsappend,L]

    ##-- Fehlerseiten auf die Sitemap lotsen
    ErrorDocument 400 /sitemap.html?error=400
    ErrorDocument 401 /sitemap.html?error=401
    ErrorDocument 402 /sitemap.html?error=402
    ErrorDocument 403 /sitemap.html?error=403
    ErrorDocument 404 /sitemap.html?error=404
    ErrorDocument 500 /sitemap.html?error=500

    ##-- BOF - Tomcraft - 2009-09-09 - Use canonical URLs
    # (don't use if your shop runs on a subdomain!)
    #
    #RewriteCond %{HTTP_HOST} !^www\. [NC]
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
    #
    ##-- EOF - Tomcraft - 2009-09-09 - Use canonical URLs

    RewriteEngine On
    RewriteRule .* http://www.domain.de/shop/ [L,R=301]

    .htacces im Unterverzeichniss /shop:

    Code: PHP  [Auswählen]
    # $Id: .htaccess,v 1.5 2005/05/19 17:09:19 Administrator Exp $
    #
    # If your shop runs in a subfolder, for example "www.domain.de/shop/"
    # you can use this .htaccess as a template.
    # Simply search and replace "/shop/" with the folder-name of your
    # custom installation-folder like "/shop/" or something.
    #
    # Attention: Leave the slashes "/" as is!
    #
    # This is used with Apache WebServers
    #
    # For this to work, you must include the parameter 'Options' to
    # the AllowOverride configuration
    #
    # Example:
    #
    #<Directory "/usr/local/apache/htdocs">
    #   AllowOverride Options
    #</Directory>
    #
    # 'All' with also work. (This configuration is in the
    # apache/conf/httpd.conf file)
    # The following makes adjustments to the SSL protocol for Internet
    # Explorer browsers
    <IfModule mod_setenvif.c>
      <IfDefine SSL>
        SetEnvIf User-Agent ".*MSIE.*" \
                 nokeepalive ssl-unclean-shutdown \
                 downgrade-1.0 force-response-1.0
      </IfDefine>
    </IfModule>

    # Fix certain PHP values
    # (commented out by default to prevent errors occuring on certain
    # servers)
    #<IfModule mod_php4.c>
    #  php_value session.use_trans_sid 0
    #  php_value register_globals 1
    #</IfModule>

    #-- set expire header for image, pdf, js and css files for 30 days
    #<FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|js|css)$" >
    #  Header set Cache-Control "max-age=2592000, public"
    #</FilesMatch>

    #-- Turn off ETags in HTTP-header
    #FileETag None

    #-- Call time pass reference error ?!
    #php_flag  allow_call_time_pass_reference On

    #-- XTC Session only on first visit
    #php_flag session.use_trans_sid 0

    #-----------------------------------------
    #- SEO Hartmut König
    #-----------------------------------------
    #-- ! Comment this line, if you get an ERROR 500 !
    #Options +FollowSymlinks

    # http://httpd.apache.org/docs/misc/rewriteguide.html
    RewriteEngine on

    #-- Sitemap
    RewriteRule ^sitemap(.*)\.html$ /shop/shop_content.php?coID=8 [qsappend,L]

    ##-- Kategorien
    RewriteCond %{REQUEST_URI} (.*):::([_0-9]+):([_0-9]+)\.html$
    RewriteRule (.*):::([_0-9]+):([_0-9]+)\.html$ /shop/index.php?cPath=$2&page=$3 [qsappend,L]
    RewriteCond %{REQUEST_URI} (.*):::([_0-9]+)\.html$
    RewriteRule (.*):::([_0-9]+)\.html$ /shop/index.php?cPath=$2 [qsappend,L]

    ##-- Produkte
    RewriteRule (.*)::(.+)\.html$ /shop/product_info.php?products_id=$2 [qsappend,L]

    ##-- Content
    RewriteRule (.*):_:([0-9]+)\.html$ /shop/shop_content.php?coID=$2 [qsappend,L]

    ##-- Manufacturers
    RewriteCond %{REQUEST_URI} (.*):.:([_0-9]+):([_0-9]+)\.html$
    RewriteRule (.*):.:([_0-9]+):([_0-9]+)\.html$ /shop/index.php?manufacturers_id=$2&page=$3 [qsappend,L]
    RewriteCond %{REQUEST_URI} (.*):.:([_0-9]+)\.html$
    RewriteRule (.*):.:([0-9]+)\.html$ /shop/index.php?manufacturers_id=$2 [qsappend,L]

    ##-- Fehlerseiten auf die Sitemap lotsen
    ErrorDocument 400 /shop/sitemap.html?error=400
    ErrorDocument 401 /shop/sitemap.html?error=401
    ErrorDocument 402 /shop/sitemap.html?error=402
    ErrorDocument 403 /shop/sitemap.html?error=403
    ErrorDocument 404 /shop/sitemap.html?error=404
    ErrorDocument 500 /shop/sitemap.html?error=500

    ##-- BOF - Tomcraft - 2009-09-09 - Use canonical URLs
    # (don't use if your shop runs on a subdomain!)
    #
    #RewriteCond %{HTTP_HOST} !^www\. [NC]
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/shop/$1 [L,R=301]
    #
    ##-- EOF - Tomcraft - 2009-09-09 - Use canonical URLs

        <IfModule mod_deflate.c>
                <FilesMatch "\.(css|js|x?html?|php)$">
                   SetOutputFilter DEFLATE
                </FilesMatch>
          </IfModule>
               
            <IfModule mod_expires.c>
              ExpiresActive On
              ExpiresDefault "access plus 1 minutes"
              ExpiresByType text/html "access plus 1 minutes"
              ExpiresByType text/css "access plus 604800 seconds"
              ExpiresByType text/javascript "aaccess plus 604800 seconds"
              ExpiresByType text/plain "access plus 604800 seconds"
              ExpiresByType application/javascript "access plus 604800 seconds"
              ExpiresByType application/x-javascript "access plus 604800 seconds"
              ExpiresByType application/x-shockwave-flash "access plus 604800 seconds"
              ExpiresByType image/gif "access plus 604800 seconds"
              ExpiresByType image/jpeg "access plus 604800 seconds"
              ExpiresByType image/jpg "access plus 604800 seconds"
              ExpiresByType image/png "access plus 604800 seconds"
              ExpiresByType image/x-icon "access plus 604800 seconds"
              ExpiresByType image/ico "access plus 604800 seconds"
              ExpiresByType application/xhtml+xml "access plus 600 seconds"
              <FilesMatch ".*\.mhtml$">
                ExpiresActive Off
              </FilesMatch>
            </IfModule>
             
            #Turn ETagging off
          FileETag none
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /shop/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /shop/index.php [L]
    </IfModule>

    # END WordPress

    ##-- no index.php
    ###### ACHTUNG FUER JTL-WAWI-CONNECTOR KONFIGURATION FOLGENDE 2 ZEILEN DEAKTIVIEREN
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]

    burrito

    • Viel Schreiber
    • Beiträge: 535
    • Geschlecht:
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #3 am: 23. März 2014, 16:12:13
    Hallo wood4u,

    In der .htaccess im Root-Verzeichnis fragst Du zunächst nach bestimmten Adressmustern ab, und änderst sie um, so dass der Shop diese verarbeiten kann. Allerdings stimmt hier evtl. der Pfad noch nicht. In der letzten Zeile (Zeile 95) fängst du dann nochmals alle Anfragen ab und leitest sie nach /shop um. (Zeile 94 ist übrigens zu spät und doppelt. Die kannst Du hier entfernen). Also auch die Anfragen, die auf den Blog gerichtet sind.

    Aktuell ist Dein Aufbau mit den beiden .htaccess nicht wirklich übersichtlich. Wenn Du das nicht extra umbauen und aufknoten möchtest, kannst Du vor der Zeile 95 einen Eintrag machen, der alle Anfragen, die nach /blog kommen auf /blog weiterleitet. Dann bleiben in der Zeile 95 nur noch die Shop-Anfragen übrig. Aber wie gesagt: Du hast weiterhin Unordnung in den .htaccess-Dateien!

    Wie soll denn der Shop und der Blog zu erreichen sein?
    Beides über gezielte Adressen, oder nur der Blog über die Adresse www.example.com/blog/index.php während der Shop über www.example.com/index.php erreicht werden soll?

    burrito

    wood4u

    • Neu im Forum
    • Beiträge: 31
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #4 am: 23. März 2014, 16:54:55
    Ich habe mir schon gedacht, dass in den .htaccess Dateien unordnung herrscht.

    Der /shop sollte über:

    www.domain.de
    domain.de

    erreicht werden.

    Der Blog über www.domain.de/blog

    Also wenn ich das richtig verstehe sollte es nur eine .htaccess geben und zwar im /shop Verzeichniss?
    Wie sollte diese denn aussehen? Gibt es da eine standard Vorlage?

    wood4u

    • Neu im Forum
    • Beiträge: 31
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #5 am: 23. März 2014, 21:45:47
    Ich habe jetzt die htaccess im root Verzeichniss gelöscht.

    Der Shop ist auch wie gewünscht erreichbar.
    Bleibt allerdings das Problem mit dem Blog.

    Was muss ich denn in der htacces ändern damit der Blog auch erreichbar ist?

    burrito

    • Viel Schreiber
    • Beiträge: 535
    • Geschlecht:
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #6 am: 23. März 2014, 21:59:54
    Wenn die .htaccess im root gelöscht ist, kannst Du den Shop einfach mit www.example.com/blog/index.php erreichen. Aber wie kommst Du durch Aufruf von www.example.com auf den Shop, wenn Du die .htaccess gelöscht hast?

    burrito

    wood4u

    • Neu im Forum
    • Beiträge: 31
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #7 am: 23. März 2014, 22:02:05
    Ja merke auch gerade dass ich nicht im Shop komme. War wohl noch im Cache...

    wood4u

    • Neu im Forum
    • Beiträge: 31
    Re: Mehrere Unterverzeichnisse | Wie .htaccess gestalten?
    Antwort #8 am: 23. März 2014, 22:12:37
    Brauch ich denn beide htacces Dateien?

    Ich verstehe einfach nicht wie ich die Dateien ändern muss, damit der Blog und der Shop sauber erreichbar sind.
    2 Antworten
    3338 Aufrufe
    23. April 2011, 15:01:55 von Jürgen
    7 Antworten
    5255 Aufrufe
    09. Juli 2016, 14:31:01 von Teratek
    39 Antworten
    22702 Aufrufe
    04. April 2015, 17:09:14 von kostja984
               
    anything