2017-10-09 106 views
1

我想添加一些自定义重定向在Wordpress安装相同的域。我想是这样的:Wordpress 404错误自定义重定向.htaccess

domain.com/get/card/123456 

去:

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

同样的原理我想发生在其他2个重定向,“客户端/验证/电子邮件/”恩“企业/验证/电子邮件/”。但是他们都没有工作。

Wordpress在说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=$1 [R] 
RewriteRule ^client/validate/email/([0-9]+)$ /client/accountinstellingen.php?code=$1 [R] 
RewriteRule ^enterprise/validate/email/([0-9]+)$ /enterprise/instellingen.php?code=$1 [R] 

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

我已经尝试把重定向之前和之后的Wordpress重定向,但没有任何这些方法的帮助。我该如何解决这个问题?

回答

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

您需要包括每个这些指令的Llast)标志。即。 [R,L]

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

+1

英雄!非常感谢!! –