Re: [DEV] [3.1] [3.2] SEO URLs
Verfasst: 16.12.2018 20:07
Hallo, hast du diese Erweiterung von Naguissa akzeptiert?
https://github.com/tas2580/seourls/issues/59
https://github.com/tas2580/seourls/issues/59
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
fernandoch hat geschrieben:Die URL sieht so aus
... /forum-titel-f123/themen-titel-t123.html
Und ich würde es gerne so haben
... /themen-titel-t123.html
Hinweis: Ich spreche kein Deutsch, ich benutze Google Translate, tut mir leid, wenn ich Fehler mache.
Hallo, ich habe die Erweiterung aktiviert und es funktioniert super. Aber ich dasselbe Anliegen wie fernandoch. Ich benötige diesen extra Ordner nicht und möchte die Themen-URL-Struktur beibehalten, da das Forum schon in einem Unterordner liegt. Also möchte ichtas2580 hat geschrieben:Hier wird die URL zu Themen erstellt, die Methode drunter ist für die URLs zu den Foren zuständig. Du kannst dort zentral alle URLs anpassen, musst aber deine Rewrite Regeln in der .htaccess entsprechend anpassen.
Code: Alles auswählen
http://www.beispiel.de/forum/thementitel-t123.html
statt
http://www.beispiel.de/forum/forumtitel-f123/thementitel-t123.html
Sodass daraus Folgendes enstanden ist:public function generate_topic_link($forum_id, $forum_name, $topic_id, $topic_title, $start = 0, $full = false)
{
if ($full)
{
return generate_board_url() . '/' . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';
}
return $this->phpbb_root_path . $this->title_to_url($forum_name) . '-f' . $forum_id . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';
}
In der .htaccess habe ich folgenden rot markierten Teil gelöscht:public function generate_topic_link($forum_id, $forum_name, $topic_id, $topic_title, $start = 0, $full = false)
{
if ($full)
{
return generate_board_url() . '/' . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';
}
return $this->phpbb_root_path . $this->title_to_url($topic_title) . '-t' . $topic_id . ($start ? '-s' . $start : '') . '.html';
}
Außerdem habe ich RewriteBase / zu RewriteBase /forum geändert, sodass ich folgende .htaccess hochgeladen habe:RewriteBase /
RewriteRule ^(.*)-f([0-9]*)/mcp.php(.*) mcp.php?%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?f=$2&t=$4&start=$5&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*).html viewtopic.php?f=$2&t=$4&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&%{QUERY_STRING} [L]
Die .htaccess befindet sich unter http://www.beispiel.de/forum/RewriteBase /forum
RewriteRule ^(.*)-f([0-9]*)/mcp.php(.*) mcp.php?%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?f=$2&t=$4&start=$5&%{QUERY_STRING} [L]
RewriteRule ^(.*)-t([0-9]*).html viewtopic.php?f=$2&t=$4&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&%{QUERY_STRING} [L]
Dann sieht es so aus:RewriteBase /forum
RewriteRule ^(.*)-f([0-9]*)/mcp.php(.*) mcp.php?%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?f=$2&t=$4&start=$5&%{QUERY_STRING} [L]
RewriteRule ^(.*)-t([0-9]*).html viewtopic.php?f=$2&t=$4&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&%{QUERY_STRING} [L]
Ob das jetzt richtig ist?RewriteBase /forum
RewriteRule ^(.*)-f([0-9]*)/mcp.php(.*) mcp.php?%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?t=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-t([0-9]*).html viewtopic.php?t=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&%{QUERY_STRING} [L]
Code: Alles auswählen
<span class="crumb"{$MICRODATA}><a href="{U_INDEX}" accesskey="h" data-navbar-reference="index" itemprop="url"><span itemprop="title">{L_INDEX}</span></a></span>
<!-- BEGIN navlinks -->
<!-- EVENT overall_header_navlink_prepend -->
<span class="crumb"{$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->><a href="{navlinks.U_VIEW_FORUM}" itemprop="url"><span itemprop="title">{navlinks.FORUM_NAME}</span></a></span>
<!-- EVENT overall_header_navlink_append -->
<!-- END navlinks -->
<!-- EVENT overall_header_breadcrumb_append -->
</li>
Code: Alles auswählen
<span class="crumb" {$MICRODATA}><a href="{U_INDEX}" itemtype="https://schema.org/Thing" itemscope itemprop="item" accesskey="h" data-navbar-reference="index"><span itemprop="name">{L_INDEX}</span></a><meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}" /></span>
<!-- BEGIN navlinks -->
{% set NAVLINK_NAME = navlinks.BREADCRUMB_NAME | default(navlinks.FORUM_NAME) %}
{% set NAVLINK_LINK = navlinks.U_BREADCRUMB | default(navlinks.U_VIEW_FORUM) %}
<!-- EVENT overall_header_navlink_prepend -->
<span class="crumb" {$MICRODATA}<!-- IF navlinks.MICRODATA --> {navlinks.MICRODATA}<!-- ENDIF -->><a href="{{ NAVLINK_LINK }}" itemtype="https://schema.org/Thing" itemscope itemprop="item"><span itemprop="name">{{ NAVLINK_NAME }}</span></a><meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}" /></span>UM}" itemtype="https://schema.org/Thing" itemprop="item"><span itemprop="name">{navlinks.FORUM_NAME}</span></a><meta itemprop="position" content="{{ navlink_position }}{% set navlink_position = navlink_position + 1 %}" /></span>
<!-- EVENT overall_header_navlink_append -->
Code: Alles auswählen
/**
* Rewrite links in breadcrumbs
*
* @param object $event The event object
* @return null
* @access public
*/
public function generate_forum_nav($event)
{
$forum_data = $event['forum_data'];
$navlinks = $event['navlinks'];
$navlinks_parents = $event['navlinks_parents'];
foreach ($navlinks_parents as $id => $data)
{
$navlinks_parents[$id]['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($data['FORUM_ID'] , $data['FORUM_NAME']));
}
$navlinks['U_VIEW_FORUM'] = append_sid($this->base->generate_forum_link($forum_data['forum_id'], $forum_data['forum_name']));
$event['navlinks'] = $navlinks;
$event['navlinks_parents'] = $navlinks_parents;
}
Code: Alles auswählen
git clone https://github.com/tas2580/seourls.git