我的旧网址是 example.com/topic/ 123456789 -my-title-here/
我的新网址是:example.com/threads/my-title-here。123456789 /
我如何使用 htaccess 将旧网址重定向到新网址
注意:我如何只能从旧网址中拆分数字,可以将此地址用于新网址:example.com/threads/123456789/
我使用 xenforo 2
我用这段代码解决了这个问题:
RewriteRule ^forum/(\d+)-(.+)/page-(\d+)$ /forums/$2.$1/page-$3? [R=301,NC,L]
RewriteRule ^forum/(\d+)-(.+)/$ /forums/$2.$1/? [R=301,NC,L]
RewriteRule ^topic/(\d+)-(.+)/page-(\d+)$ /threads/$2.$1/page-$3? [R=301,NC,L]
RewriteRule ^topic/(\d+)-(.+)/$ /threads/$2.$1/? [R=301,NC,L]
RewriteRule ^user/(\d+)-(.+)/$ /members/$2.$1/? [R=301,NC,L]
RewriteEngine On
在.htaccess
文件中添加以下代码