WordPress 404 错误自定义重定向.htaccess

Wordpress 404 error custom redirect .htaccess

我想在与 Wordpress 安装相同的域中添加一些自定义重定向。我想要这样的东西:

domain.com/get/card/123456 

前往:

domain.com/account/client/redirectNewCard.php?id=123456

我希望其他 2 个重定向的原理相同,"client/validate/email/" en "enterprise/validate/email/"。但是 none 有效。

Wordpress 显示 "Page not found" 的 404 页面,但访问 "my domain.com/account/client/redirectNewCard.php?id=123456" 确实有效并显示了应该显示的内容。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^get/card/([0-9]+)$ /account/client/redirectNewCard.php?id= [R]
RewriteRule ^client/validate/email/([0-9]+)$ /client/accountinstellingen.php?code= [R]
RewriteRule ^enterprise/validate/email/([0-9]+)$ /enterprise/instellingen.php?code= [R]

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

我已经尝试将重定向放在 Wordpress 重定向之前和之后,但是 none 这些方法有帮助。我该如何解决?

RewriteRule ^get/card/([0-9]+)$ /account/client/redirectNewCard.php?id= [R]
RewriteRule ^client/validate/email/([0-9]+)$ /client/accountinstellingen.php?code= [R]
RewriteRule ^enterprise/validate/email/([0-9]+)$ /enterprise/instellingen.php?code= [R]

您需要在每个指令中包含 L (last) 标志。 IE。 [R,L].

没有 L 标志,处理将继续,并且很可能被 WordPress 前端控制器重写。您需要立即停止处理并重定向。