【问题标题】:htaccess redirect entire website except the wordpress backendhtaccess 重定向整个网站,除了 wordpress 后端
【发布时间】:2017-02-16 00:11:13
【问题描述】:

我正在尝试将整个 wordpress 网站重定向到另一个域,但希望能够访问仪表板。

这是我尝试过的:

RewriteEngine on
RewriteRule http://thisdomain.com/wp-admin/ - [L]
RewriteRule (.*) http://newdomain.com/ [R=301,L]

【问题讨论】:

标签: wordpress .htaccess redirect


【解决方案1】:

您需要修改规则。试试这个

RewriteEngine On
RewriteCond %{HTTP_HOST} ^thisdomain.com$ [NC]
RewriteCond %{REQUEST_URI} !^(.*)?wp-login\.php(.*)$
RewriteCond %{REQUEST_URI} !^(.*)?wp-admin$
RewriteRule ^(.*)$ http://newdomain.com/ [R=301,L]

【讨论】:

  • 谢谢@Majid,但这给了我内部服务器错误
  • 现在试试,有多余的空间复制粘贴再告诉我
  • thisdomain.com/wp-admin 仍然重定向到新域
  • 再次更新抱歉,我忘记删除新域末尾的 $1。再试一次,我在本地测试过,现在可以了。谢谢
猜你喜欢
  • 1970-01-01
  • 2013-01-06
  • 1970-01-01
  • 1970-01-01
  • 2015-10-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-14
相关资源
最近更新 更多