SEO freundliche URLs

Fragen zur Installation von CONTENIDO 4.10? Probleme bei der Konfiguration? Hinweise oder Fragen zur Entwicklung des Systemes oder zur Sicherheit?
Antworten
peanut
Beiträge: 246
Registriert: Do 25. Nov 2004, 19:34
Kontaktdaten:

SEO freundliche URLs

Beitrag von peanut » So 11. Dez 2022, 11:28

Hallo zusammen

Hab das Prolem selber gelöst bekommen bzw. mit Hilfe der neuen Chatbot K.i. - Krass kann ich nur allen raten sich das anzusehen.

Also wie der Info Text am Boden sagt muss der ganz nach oben vor allen anderen Einträgen !! Damit gings schonmal.

Wer nur die Startseite umschreiben lassen will kann den Eintrag hier nehmen:

Code: Alles auswählen

    # if the request is for example.com/index.html"
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTPS/
# then redirect to "example.com/"
RewriteRule ^index\.html$ https://example.com [R=301,L]
Status: erledigt

Da meine neue Seite bei Google nicht gelistet wird wegen der Sache mit dem duplicate content, bin ich der Sache mal nachgegangen.

Das Problem mit den multiplen Pfaden. http:// und www. habe ich mal weggelassen als Varianten.

https://example.com/index.html
https://example.com/
https://example.com ( Ziel )
https://example.com/kategorie/index.html
https://example.com/kategorie/
https://example.com/kategorie ( Ziel )

Wie bekommt man das modulübergreifend und elegant stromsparend hin :-)

Es gibt die theoretischen Möglichkeiten:

1. Via Apache direkt ?
2. Via .htaccess ?
3. Via Uri shortener Modul ?
4. Via AMR ?
5. Irgendeine geheime .php Seite ?

Ich habe zu dem Thema das hier gefunden aber das geht irgendwie nicht bei der 4.10.1

Code: Alles auswählen

RewriteCond %{THE_REQUEST} index\.html [NC]
RewriteRule ^(.*)index\.html /$1 [NC,L,R=301]
viewtopic.php?f=105&t=32922&p=157900&hi ... nt#p157900

Meine .htaccess liegt im Root /

Jemand eine gute Idee ?
Danke im Voraus


######## Regel scheint soweit gülig zu sein laut K.i. - Für den der es genau wissen wil :-)

ist dieser htaccess eintrag valid ? RewriteCond %{THE_REQUEST} index\.html [NC]
RewriteRule ^(.*)index\.html /$1 [NC,L,R=301]

Yes, the .htaccess rewrite rule you provided is valid and should work as intended. The rule uses the RewriteCond directive to check if the requested URL ends with index.html, and if so, it uses the RewriteRule directive to redirect the request to the same URL without the index.html part.

Here is a breakdown of the rule and what each part does:

RewriteCond %{THE_REQUEST} index\.html [NC]: This line uses the RewriteCond directive to create a condition that checks if the requested URL ends with index.html. The %{THE_REQUEST} variable contains the original request that was sent by the client, and the index\.html part of the condition checks if the request ends with index.html. The [NC] flag at the end of the line makes the match case-insensitive, so the condition will match both index.html and Index.html, for example.
RewriteRule ^(.*)index\.html /$1 [NC,L,R=301]: This line uses the RewriteRule directive to create a rule that applies the redirect if the condition specified in the RewriteCond directive is met. The ^(.*)index\.html part of the rule matches the URL that was requested, and the /$1 part of the rule specifies the target URL of the redirect. In this case, the target URL is the same as the original URL, but with the index.html part removed. The [NC,L,R=301] flags at the end of the line specify that the match should be case-insensitive (NC), the rule should be applied immediately without evaluating any further rules (L), and the redirect should be a permanent redirect (R=301).

Overall, the .htaccess rule you provided is a valid and well-formed rewrite rule that should work as intended. I hope this helps! Let me know if you have any other questions.
Zuletzt geändert von peanut am So 11. Dez 2022, 13:17, insgesamt 1-mal geändert.
du liest nie ein Buch und weisst weise der Bildung auszuweichen ....

bodil
Beiträge: 340
Registriert: Fr 7. Okt 2011, 04:10
Kontaktdaten:

Re: SEO freundliche URLs

Beitrag von bodil » So 11. Dez 2022, 12:59

Falls ich dein Problem richtig verstanden habe, lässt es sich dadurch lösen, dass du auf jede Seite in den head eine Canonical URL schreibst.
Deren Sinn ist hier erklärt:
https://de.wikipedia.org/wiki/Canonical_Link
Kurz zusammengefasst: egal, über welche URL Google auf deine Seite kommt, im Link steht, welche Seite für diesen Content (einmalig) als relevant angesehen und indiziert werden soll.
Das könnte etwa so aussehen:

Code: Alles auswählen

$prop = array('idcat' => cRegistry::getCategoryId(), 'lang' => cRegistry::getLanguageId());
if (is_startarticle()) {
	$prop['idart'] = cRegistry::getArticleId();
}
$url = cUri::getInstance()->build($prop);
if ($url == '/Start/index.html') {
	$url = '';
}
$canonicalUrl = $_SERVER['HTTP_HOST'] . '/' . $url;
echo '<link rel="canonical" href="https://' . $canonicalUrl . '" />' . "\r\n"; /**/
?>
Aber Achtung, das ist eher symbolisch gemeint, und muss auf die jeweilige Seite zugeschnitten werden. Die Funktion is_startarticle() gibt es so nicht.

peanut
Beiträge: 246
Registriert: Do 25. Nov 2004, 19:34
Kontaktdaten:

Re: SEO freundliche URLs

Beitrag von peanut » So 11. Dez 2022, 13:31

Danke dir für die Antwort aber Cannonical geht ja nicht mit dem Modul weil es auf sich selber verlinkt.

Wie im ersten Post beschrieben. Habs doch echt selber rausgefunden.

Wer eben nicht jedes Modul umschrieben möchte sondern nur die Startseite sollte den ersten Eintrag oben nehemen. Bei mir geht es damit genau so wie gewünscht.
du liest nie ein Buch und weisst weise der Bildung auszuweichen ....

Antworten