Von vBulletin auf Discourse migrieren und alte vBulletin-URLs auf neue Discourse-URLs umleiten möchten? Lesen Sie weiter!
Wenn die Basis-URL Ihres alten Forums und Ihres neuen Forums identisch ist, sollten Sie stattdessen diese Anleitung befolgen:
Redirect old forum URLs to new Discourse URLs using permalinks
In dieser Anleitung gehen wir von Folgendem aus:
-
vBulletin-Basis-URL:
www.example.com/forum -
Discourse-Basis-URL:
forum.example.com -
Nginx-Server für
www.example.com
Legen wir los!
Nginx-Map-Datei generieren
Um die Umleitung von Kategorien und Themen einzurichten, verwenden wir das Nginx-Map-Modul. Die CSV-Datei wird (script/import_scripts/vb_map.csv) während des Imports über die Methode create_permalink_file generiert. Wir fügen den Inhalt der CSV-Datei in die Map-Datei auf dem Server ein.
Beispielinhalt der Datei:
...
/forum/forumdisplay.php?6 http://forum.example.com/c/games;
/forum/forumdisplay.php?7 http://forum.example.com/c/movies;
/forum/forumdisplay.php?13 http://forum.example.com/c/admin;
/forum/showthread.php?1 http://forum.example.com/t/x/22;
/forum/showthread.php?2 http://forum.example.com/t/x/23;
/forum/showthread.php?3 http://forum.example.com/t/x/24;
/forum/showthread.php?4 http://forum.example.com/t/x/25;
...
Kopieren Sie den gesamten Inhalt der generierten CSV-Datei nach etc/nginx/vb_forum.map auf dem Server von www.example.com.
nginx.conf bearbeiten
Bearbeiten Sie die Datei /etc/nginx/nginx.conf, um diesen Code im http-Block hinzuzufügen:
map_hash_bucket_size 128;
map_hash_max_size 80000;
map $request_uri $new {
include /etc/nginx/vb_forum.map;
}
server {
listen 80;
server_name www.example.com;
location ~ ^/forum\\/showthread.php {
if ($args ~* ^(\\d+)-(.+)$) {
set $tid $1;
set $args '';
rewrite ^ /forum/showthread.php?$tid permanent;
}
if ($args ~* ^t=(\\d+)$) {
set $tid $1;
set $args '';
rewrite ^ /forum/showthread.php?$tid permanent;
}
return 301 http://forum.example.com;
}
location ~ ^/forum\\/forumdisplay.php {
if ($args ~* ^(\\d+)-(.+)$) {
set $tid $1;
set $args '';
rewrite ^ /forum/forumdisplay.php?$tid permanent;
}
if ($args ~* ^f=(\\d+)$) {
set $tid $1;
set $args '';
rewrite ^ /forum/forumdisplay.php?$tid permanent;
}
return 301 http://forum.example.com;
}
if ($new) {
rewrite ^ $new permanent;
}
location /forum {
return 301 http://forum.example.com;
}
}
map_hash_max_size muss basierend auf der Anzahl der in der Map-Datei enthaltenen URLs angepasst werden.
nginx.conf überprüfen
Überprüfen Sie Ihre Nginx-Konfigurationsdatei:
nginx -c /etc/nginx/nginx.conf -t
Laden Sie Ihre Nginx-Konfiguration neu, um Ihre Änderungen zu übernehmen:
sudo systemctl reload nginx
Versuchen Sie, www.example.com/forum aufzurufen. Sie sollten nun auf forum.example.com umgeleitet werden. ![]()
Folgende URL-Typen werden von der obigen Nginx-Konfiguration behandelt:
-
www.example.com/forum–\u003eforum.example.com -
www.example.com/forum/forumdisplay.php?6–\u003eforum.example.com/c/games -
www.example.com/forum/forumdisplay.php?6-Games–\u003eforum.example.com/c/games -
www.example.com/forum/forumdisplay.php?f=6–\u003eforum.example.com/c/games -
www.example.com/forum/showthread.php?2–\u003eforum.example.com/t/topic-slug/23 -
www.example.com/forum/showthread.php?2-topic-slug–\u003eforum.example.com/t/topic-slug/23 -
www.example.com/forum/showthread.php?t=2–\u003eforum.example.com/t/topic-slug/23