vbulletin到wordpress htaccess url永久链接重定向

时间:2019-04-04 15:19:49

标签: wordpress .htaccess url-rewriting permalinks vbulletin

我将网站从vB迁移到WP,但是我很难让永久链接正常工作。

我已使用#注释掉了无效的重写。

这是我当前的htaccess:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^[0-9]+-([^&]+)
RewriteRule ^/?showthread\.php$ https://www.example.com/forums/topic/%1 [L,R=301]   // this one works

# These don't work
#RewriteRule [^content.php/]+/([0-9]+)-[^/]+\.html https://www.example.com/%1 [L,R=302]  // doesn't work

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

更改mydomain.com/content.php/categoryname-categoryid.html

我尝试了这个:

RewriteRule [^content.php/]+/([0-9]+)-[^/]+\.html https://www.example.com/%1 [L,R=302]

and also this:

RewriteRule [^content.php/]+/([0-9]+)-[^/]+\.html https://www.example.com/[^/]%1 [L,R=302]

但不会转换 https://www.example.com/content.php/131-Anniversary 到:https://www.example.com/anniversary/131-categorytitle

相反,它将其更改为bbpress论坛主题:

https://www.example.com/community/topic/anniversary-10-free-products

我正在尝试获取基于类别的网址:

https://www.example.com/content.php/131-Anniversary

变成https://www.example.com/%category%/%categoryid%-%categoryname%

以下是vbulletin的两种类型的url,我需要在htaccess重写中提供一些帮助:

A. https://www.example.com/recipes/how-cook-perfect-bacon-everytime-3424.html

B: https://www.example.com/content.php?r=3424

两者都应重定向到:

https://www.example.com/%category%/%postid%-%postname% 

which looks like this: https://www.example.com/recipes/3424-how-cook-perfect-bacon-everytime

这些是我在vBulletin中用来防止链接中断的重写:

RewriteEngine on
RewriteRule [^/]+/([0-9]+)-[^/]+\.html https://www.example.com/showthread.php?t=$1 [L,R=301]
RewriteRule [^/]+/[^/]+-([0-9]+)\.html https://www.example.com/content.php?r=$1 [L,R=301]
RewriteRule [^/]+/[^/]+-([0-9]+)/ https://www.example.com/content.php?r=$1 [L,R=301]

我在做什么错了?

0 个答案:

没有答案