¿Estás migrando de vBulletin a Discourse y quieres redirigir las antiguas URLs de vBulletin a las nuevas URLs de Discourse? ¡Sigue leyendo!
Si la URL base de tu antiguo foro y la de tu nuevo foro son iguales, deberías seguir esta guía en su lugar:
Redirect old forum URLs to new Discourse URLs using permalinks
En esta guía asumiremos:
-
URL base de vBulletin:
www.example.com/forum -
URL base de Discourse:
forum.example.com -
Servidor Nginx para
www.example.com
¡Comencemos!
Generar el archivo de mapa de Nginx
Para configurar la redirección de categorías y temas, utilizaremos el módulo map de Nginx. El archivo CSV se generará (script/import_scripts/vb_map.csv) durante la importación mediante el método create_permalink_file. Pegaremos el contenido del archivo CSV en el archivo de mapa en el servidor.
Contenido de ejemplo del archivo:
...
/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;
...
Copia todo el contenido del archivo CSV generado a etc/nginx/vb_forum.map en el servidor de www.example.com.
Editar nginx.conf
Edita el archivo /etc/nginx/nginx.conf para agregar este código en el bloque http:
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 debe ajustarse según la cantidad de URLs presentes en el archivo de mapa.
Verificar nginx.conf
Verifica tu archivo de configuración de Nginx:
nginx -c /etc/nginx/nginx.conf -t
Recarga tu configuración de Nginx para incluir tus cambios:
sudo systemctl reload nginx
Intenta acceder a www.example.com/forum; ahora deberías ser redirigido a forum.example.com. ![]()
Los siguientes tipos de URLs serán manejados por la configuración de Nginx anterior:
-
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