+ Antworten
Seite 1 von 2 1 2 LetzteLetzte
Ergebnis 1 bis 10 von 12

Thema: SEO htaccess URL's mit index.php umleiten auf die links ohne index.php

  1. #1
    Neu an Board
    Registriert seit
    07.06.2006
    Beiträge
    53
    Bedankte sich
    4
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard SEO htaccess URL's mit index.php umleiten auf die links ohne index.php

    Hi leute, habe mod_rewrite und SEO in den Konfiguration von Joomla aktiviert und funktionieren auch.

    Nur sind die alten Links jetzt schon bei google im cache wie kann ich es machen sodass die Links mit index.php auf die mit mod_rewrite erstellten links ohne index.php verlinken?

    Es funkitonieren zwar die Links mit index.php auch noch wenn ich mod_rewrite aktiviere jedoch will ich diese Verlinken sodass einfach nur noch die ohne index.php vorhanden sind.

    das heißt wenn ich eingebe:
    http://domain.de/index.php/xyz/yzx

    dann soll ich sofort auf die URL kommen:
    http://domain.de/xyz/yzx

    wie stelle ich das in der .htaccess denn ein?

    Danke im voraus...

  2. #2
    Hat hier eine Zweitwohnung Avatar von progandy
    Registriert seit
    25.06.2007
    Beiträge
    1.936
    Bedankte sich
    13
    Erhielt 638 Danksagungen
    in 575 Beiträgen

    Standard

    Ich schätze, so etwas in die Richtung sollte funktionieren (wenn schon zuvor SEF ohne mod_rewrite aktiv war). Füge das nach RewriteEngine On in die .htaccess ein:
    Code:
    RewriteCond %{REQUEST_URI} ^/index\.php$ [OR]
    RewriteCond %{REQUEST_URI} ^/index\.php/
    RewriteRule ^index\.php(.*)$ http://www.example.com/$1 [R=301,L,NE]
    Suche und FAQ helfen bei Problemen oft weiter!

  3. #3
    Neu an Board
    Registriert seit
    07.06.2006
    Beiträge
    53
    Bedankte sich
    4
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    Zitat Zitat von progandy Beitrag anzeigen
    Ich schätze, so etwas in die Richtung sollte funktionieren (wenn schon zuvor SEF ohne mod_rewrite aktiv war). Füge das nach RewriteEngine On in die .htaccess ein:
    Code:
    RewriteCond %{REQUEST_URI} ^/index\.php$ [OR]
    RewriteCond %{REQUEST_URI} ^/index\.php/
    RewriteRule ^index\.php(.*)$ http://www.example.com/$1 [R=301,L,NE]
    Nein das funktioniert leider nicht.
    Hab das example natürlich eh geändert...

    Hast du noch eine andere Lösung?

  4. #4
    Hat hier eine Zweitwohnung Avatar von progandy
    Registriert seit
    25.06.2007
    Beiträge
    1.936
    Bedankte sich
    13
    Erhielt 638 Danksagungen
    in 575 Beiträgen

    Standard

    Diese Zeilen müssen nach RewriteEngine On in die .htaccess.
    Du kannst es aber auch noch abkürzen auf eine Zeile
    Code:
    RewriteEngine On
    RewriteRule ^index\.php(?:/(.*))?$ http://www.example.com/$1 [R=301,L,NE]
    Edit: Damit die nicht-SEF Links noch funktionieren, sollte es besser so aussehen:
    Code:
    RewriteEngine On
    
    RewriteRule ^index\.php/(.*)$ http://www.example.com/$1 [R=301,L,NE]
    
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^index\.php$ http://www.example.com/ [R=301,L,NE]
    Geändert von progandy (01.07.2010 um 09:19 Uhr)
    Suche und FAQ helfen bei Problemen oft weiter!

  5. #5
    Neu an Board
    Registriert seit
    07.06.2006
    Beiträge
    53
    Bedankte sich
    4
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    Zitat Zitat von progandy Beitrag anzeigen
    Diese Zeilen müssen nach RewriteEngine On in die .htaccess.
    Du kannst es aber auch noch abkürzen auf eine Zeile
    Code:
    RewriteEngine On
    RewriteRule ^index\.php(?:/(.*))?$ http://www.example.com/$1 [R=301,L,NE]
    Edit: Damit die nicht-SEF Links noch funktionieren, sollte es besser so aussehen:
    Code:
    RewriteEngine On
    
    RewriteRule ^index\.php/(.*)$ http://www.example.com/$1 [R=301,L,NE]
    
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^index\.php$ http://www.example.com/ [R=301,L,NE]

    wenn ich das nehme dann passen die verlinkungen nichtmehr, also ich komme immer zur root seite wenn ich auf einen Menüpunkt klicke.

    aber nur wenn ich das nach das erste Rewriteengine on kopiere, wenn ich es am ende der .htaccess kopiere also nach der ########## End - Joomla! core SEF Section dann gehts gar nicht, und vorher gehen die urls nicht. kann es sein dass sich da etwas überlagert?
    Geändert von grease082 (05.07.2010 um 14:41 Uhr)

  6. #6
    Neu an Board
    Registriert seit
    07.06.2006
    Beiträge
    53
    Bedankte sich
    4
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    PHP-Code:
    ##
    # @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
    # @package Joomla
    # @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
    # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
    # Joomla! is Free Software
    ##


    #####################################################
    #  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
    #
    # The line just below this section: 'Options +FollowSymLinks' may cause problems
    # with some server configurations.  It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url's.  If they work,
    # it has been set by your server administrator and you do not need it set here.
    #
    #####################################################

    ##  Can be commented out if causes errors, see notes above.
    Options +FollowSymLinks

    #
    #  mod_rewrite in use

    RewriteEngine On

    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    ## Deny access to extension xml files (uncomment out to activate)
    #<Files ~ "\.xml$">
    #Order allow,deny
    #Deny from all
    #Satisfy all
    #</Files>
    ## End of deny access to extension xml files
    RewriteCond %{QUERY_STRINGmosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRINGbase64_encode.*(.*) [OR]
    # Block out any script that includes a ********** tag in URL
    RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRINGGLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING_REQUEST(=|[|%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits

    #  Uncomment following line if your webserver's URL
    #  is not directly related to physical file paths.
    #  Update Your Joomla! Directory (just / for root)

    # RewriteBase /


    ########## Begin - Joomla! core SEF Section
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond 
    %{REQUEST_FILENAME} !-d
    RewriteCond 
    %{REQUEST_URI} !^/index.php
    RewriteCond 
    %{REQUEST_URI} (/|.php|.html|.htm|.feed|.pdf|.raw|/[^.]*)$  [NC]
    RewriteRule (.*) index.php
    RewriteRule 
    .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    #
    ########## End - Joomla! core SEF Section


    RewriteCond %{REQUEST_URI} ^/index.php$ [OR]
    RewriteCond %{REQUEST_URI} ^/index.php/
    RewriteRule ^index.php(.*)$ http://www.example.com/$1 [R=301,L,NE] 
    Irgendwas stimmt da nicht, so funktioniert das nicht. Auch wenn ich example ausbessere...das am Schluss greift einfach nicht. Wenn ichs weiter hoch schreibe dann gehen alle Links nur nach http://www.example.com/ .

  7. #7
    Hat hier eine Zweitwohnung Avatar von progandy
    Registriert seit
    25.06.2007
    Beiträge
    1.936
    Bedankte sich
    13
    Erhielt 638 Danksagungen
    in 575 Beiträgen

    Standard

    Du solltest es so machen, natürlich example.com mit deiner Adresse vertauschen.

    --- Code entfernt, steht ja noch im Zitat ---
    Geändert von progandy (08.07.2010 um 09:31 Uhr)
    Suche und FAQ helfen bei Problemen oft weiter!

  8. #8
    Neu an Board
    Registriert seit
    07.06.2006
    Beiträge
    53
    Bedankte sich
    4
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    Zitat Zitat von progandy Beitrag anzeigen
    Du solltest es so machen, natürlich example.com mit deiner Adresse vertauschen.

    PHP-Code:
    ##
    # @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
    # @package Joomla
    # @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
    # @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
    # Joomla! is Free Software
    ##


    #####################################################
    #  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
    #
    # The line just below this section: 'Options +FollowSymLinks' may cause problems
    # with some server configurations.  It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url's.  If they work,
    # it has been set by your server administrator and you do not need it set here.
    #
    #####################################################

    ##  Can be commented out if causes errors, see notes above.
    Options +FollowSymLinks

    #
    #  mod_rewrite in use

    RewriteEngine On 

    RewriteCond  
    %{REQUEST_METHOD} ^GET
    RewriteRule 
    ^index.php/(.*)$ http://www.example.com/$1 [R=301,L,NE]

    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{QUERY_STRING} ^$
    RewriteRule ^index.phphttp://www.example.com/ [R=301,L,NE]

    # Aufrufe ohne www auf Adresse mit www umleiten.
    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond  
    %{HTTP_HOST} !^$
    RewriteCond  %{HTTP_HOST} !^www.example.com$
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L,NE]

    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    ## Deny access to extension xml files (uncomment out to activate)
    #<Files ~ "\.xml$">
    #Order allow,deny
    #Deny from all
    #Satisfy all
    #</Files>
    ## End of deny access to extension xml files
    RewriteCond %{QUERY_STRINGmosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRINGbase64_encode.*(.*) [OR]
    # Block out any script that includes a ********** tag in URL
    RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRINGGLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING_REQUEST(=|[|%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits

    #  Uncomment following line if your webserver's URL
    #  is not directly related to physical file paths.
    #  Update Your Joomla! Directory (just / for root)

    # RewriteBase /


    ########## Begin - Joomla! core SEF Section
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond 
    %{REQUEST_FILENAME} !-d
    RewriteCond 
    %{REQUEST_URI} !^/index.php
    RewriteCond 
    %{REQUEST_URI} (/|.php|.html|.htm|.feed|.pdf|.raw|/[^.]*)$  [NC]
    RewriteRule (.*) index.php
    RewriteRule 
    .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    #
    ########## End - Joomla! core SEF Section 
    Ja wenn ich es so mache wird es immer wieder auf die http://www.example.com/ domain geleitet und bei jedem Link den ich auf der Seite mache wird es wieder dorthin geleitet. Das bedeutet ich sehe nur die Startseite und sonst kann ich nirgends herum navigieren.

    Muss ich apache neu starten oder irgendwas...kann es schwierigkeiten mit tomcat geben?

    Und ja ich habe die example.com mit meiner domain getauscht

    Also ich versuche es noch einmal zu erklären:

    Ich habe eine Seite, diese läuft mit SEO also Suchmaschinenfreundliche URL's.
    Das heißt der Link sieht zb. so aus:
    http://www.example.com/index.php/de/...infos-fuer-xyz

    Nun habe ich mod_rewrite aktiviert, URL sieht so aus:
    http://www.example.com/de/aktuell/infos-fuer-xyz

    Jetzt will ich dass wenn ich im Browser eingebe:
    http://www.example.com/index.php/de/...infos-fuer-xyz

    dass ich automatisch weitergeleitet werde zu:
    http://www.example.com/de/aktuell/infos-fuer-xyz

    und das mit allen Seiten.

    Wie mach ich das? Oder stimmt der Code dann eh so und es liegt am Server dass es nicht geht?
    Geändert von grease082 (06.07.2010 um 23:39 Uhr)

  9. #9
    Hat hier eine Zweitwohnung Avatar von progandy
    Registriert seit
    25.06.2007
    Beiträge
    1.936
    Bedankte sich
    13
    Erhielt 638 Danksagungen
    in 575 Beiträgen

    Standard

    Das verstehe ich gerade auch nicht. Erweitere es mal so (Ausschnitt). Ein Neustart sollte nicht nötig sein.
    PHP-Code:
    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{REQUEST_URI} ^/index.php/
    RewriteRule ^index.php/(.*)$ http://www.example.com/$1 [R=301,L,NE]

    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{REQUEST_URI} ^/index.php$
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^index.phphttp://www.example.com/ [R=301,L,NE] 
    Suche und FAQ helfen bei Problemen oft weiter!

  10. #10
    Neu an Board
    Registriert seit
    07.06.2006
    Beiträge
    53
    Bedankte sich
    4
    Erhielt 0 Danksagungen
    in 0 Beiträgen

    Standard

    Zitat Zitat von progandy Beitrag anzeigen
    Das verstehe ich gerade auch nicht. Erweitere es mal so (Ausschnitt). Ein Neustart sollte nicht nötig sein.
    PHP-Code:
    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{REQUEST_URI} ^/index.php/
    RewriteRule ^index.php/(.*)$ http://www.example.com/$1 [R=301,L,NE]

    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{REQUEST_URI} ^/index.php$
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^index.phphttp://www.example.com/ [R=301,L,NE] 

    Ja habe ich gerade gemacht, aber es funktioniert auch nicht ist genau das selbe Problem es wird nur die Domain immer aufgerufen aber ich komme nicht auf eine Unterseite.

    Meine .htaccess sieht wie folgt aus natürlich URL geändert...

    PHP-Code:
    Options +FollowSymLinks

    #
    #  mod_rewrite in use

    RewriteEngine On 

    RewriteCond  
    %{REQUEST_METHOD} ^GET
    RewriteRule 
    ^index.php/(.*)$ http://www.example.com/$1 [R=301,L,NE]

    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{QUERY_STRING} ^$
    RewriteRule ^index.phphttp://www.example.com/ [R=301,L,NE]

    # Aufrufe ohne www auf Adresse mit www umleiten.
    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond  
    %{HTTP_HOST} !^$
    RewriteCond  %{HTTP_HOST} !^www.example.com$
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L,NE]

    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{REQUEST_URI} ^/index.php/
    RewriteRule ^index.php/(.*)$ http://www.example.com/$1 [R=301,L,NE]

    RewriteCond  %{REQUEST_METHOD} ^GET
    RewriteCond 
    %{REQUEST_URI} ^/index.php$
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^index.phphttp://www.example.com/ [R=301,L,NE]  

    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    ## Deny access to extension xml files (uncomment out to activate)
    #<Files ~ "\.xml$">
    #Order allow,deny
    #Deny from all
    #Satisfy all
    #</Files>
    ## End of deny access to extension xml files
    RewriteCond %{QUERY_STRINGmosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRINGbase64_encode.*(.*) [OR]
    # Block out any script that includes a ********** tag in URL
    RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRINGGLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING_REQUEST(=|[|%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits

    #  Uncomment following line if your webserver's URL
    #  is not directly related to physical file paths.
    #  Update Your Joomla! Directory (just / for root)

    # RewriteBase /


    ########## Begin - Joomla! core SEF Section
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond 
    %{REQUEST_FILENAME} !-d
    RewriteCond 
    %{REQUEST_URI} !^/index.php
    RewriteCond 
    %{REQUEST_URI} (/|.php|.html|.htm|.feed|.pdf|.raw|/[^.]*)$  [NC]
    RewriteRule (.*) index.php
    RewriteRule 
    .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    #
    ########## End - Joomla! core SEF Section 

+ Antworten
Seite 1 von 2 1 2 LetzteLetzte

Lesezeichen

Berechtigungen

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