[英]How to display sub domain posts in main domain home page on wordpress?
I am new to using multiple sites handling in wordpress.我不熟悉在 wordpress 中使用多个站点处理。 I have a site say, domain.com and sub domains as sub1.domain.com and sub2.domain.com.
我有一个网站说,domain.com 和 sub1.domain.com 和 sub2.domain.com 的子域。 I have installed WP with multi site option for domain.com and WP installed for sub1.domain.com and sub2.domain.com.
我已经为 domain.com 安装了带有多站点选项的 WP,并为 sub1.domain.com 和 sub2.domain.com 安装了 WP。 Now, i am going to post in the sub domains, and i have to retrieve them in main domain homepage.
现在,我要在子域中发帖,我必须在主域主页中检索它们。
How can i do this?我怎样才能做到这一点? i found few plugins with which am unable to achieve my goal.
我发现很少有插件无法实现我的目标。 the plugins i have tried wp multisite and a few more.
我尝试过的插件 wp multisite 等等。
i found it's little bit tough job to do.我发现这有点难做。 can anyone give a step by step procedure to get it done.
谁能给出一步一步的程序来完成它。
and my .htaccess file contains the following code,我的 .htaccess 文件包含以下代码,
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
So, If i change this code, will all of sub domain posts appear on main domain home page?那么,如果我更改此代码,所有子域帖子都会出现在主域主页上吗?
To display those posts, what i need to add in main domain index page?要显示这些帖子,我需要在主域索引页面中添加什么?
Try adding this to an appropriate place in your .htaccess file located in Root folder of your site :尝试将其添加到位于站点根文件夹中的 .htaccess 文件中的适当位置:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.domain\.com$ [NC]
RewriteRule ^ http://domain.com/ [L,R]
To exclude www subdomain , www.domain.com, add this line before the RewriteRule:要排除 www 子域 www.domain.com,请在 RewriteRule 之前添加此行:
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.