[英]Redirect wp-login.php and wp-login.php?action=register to homepage using .htaccess
As the title suggests, how can I redirect the following URL's to the homepage of my WordPress website? 如标题所示,如何将以下URL重定向到WordPress网站的首页?
www.widget.com/wp-login.php
www.widget.com/wp-login.php
www.widget.com/wp-login.php/wp-login.php?action=registerwww.widget.com/wp-login.php/wp-login.php?action=register
I have tried the following line in the .htaccess file (located at site root): 我在.htaccess文件(位于站点根目录)中尝试了以下行:
RewriteCond %{QUERY_STRING} ^action=register$
RewriteCond%{QUERY_STRING} ^ action = register $
RewriteRule wp-login[.]php$ http://www.widget.com [R,NC,L]RewriteRule wp-login [。] php $ http://www.widget.com [R,NC,L]
Having no luck! 没有运气!
Try the following: 请尝试以下操作:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-login.php$
RewriteCond %{QUERY_STRING} ^action=register$
RewriteRule ^(.*)$ http://www.widget.com [R=301,L]
You can always just do a normal 301 redirect, which should include query strings too: 您始终可以只执行普通的301重定向,该重定向也应包括查询字符串:
redirect 301 /wp-login.php http://www.widget.com
You probably want this too: 您可能也想要这样:
redirect 301 /wp-admin http://www.widget.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.