简体   繁体   English

将所有重定向到除wp-admin和wp-json之外的其他域

[英]Redirect all to different domain except wp-admin and wp-json

I want to redirect all pages to http://www.expample2.com except the wp-admin and wp-json. 我想将除wp-admin和wp-json之外的所有页面重定向到http://www.expample2.com

For example the user is able to login to http://www.example1.com/wp-admin and the wp-json plugin still has to work which is in http://www.example1.com/wp-json/ ... 例如,用户能够登录到http://www.example1.com/wp-admin ,而wp-json插件仍必须工作,该插件位于http://www.example1.com/wp-json/中 。 ..

Also within the wp-admin the user can click to show a post for example. 同样在wp-admin中,用户可以单击以显示帖子。 http://www.example1.com/post/title but I want this to point to http://www.example2.com/book/title http://www.example1.com/post/title,但我希望它指向http://www.example2.com/book/title

However in order for the json to work right this script has to work to I think: 但是,为了使json正常工作,我认为此脚本必须有效:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/wp-admin.*
RewriteCond %{REQUEST_URI} !^/wp-json.*
RewriteRule ^(.*)$ http://www.example2.com$1 [L,R=301]
</IfModule>

Place this inside your <VirtualHost> for your www.example1.com . 将其放在www.example1.com <VirtualHost>中。 The snippet you included in the question looks like the standard Wordpress .htaccess file in its root folder, yes? 问题中包含的代码段看起来像是其根文件夹中的标准Wordpress .htaccess文件,是吗? That is why it is better to change your Apache conf. 这就是为什么最好更改您的Apache conf。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM