简体   繁体   English

停止子域重定向到Wordpress中的主域

[英]Stop subdomain redirects to main domain in wordpress

I have a website that is build in WordPress. 我有一个用WordPress构建的网站。

I want to build the sub-domains for the site according to the states same as "olx.in" do for different cities. 我想根据与“ olx.in”针对不同城市所做的相同状态来构建站点的子域。

Everything is setup from the code, server and hosting side, but the problem I am facing is that when I type any sub-domain in the URL like "rj.mysite.com" then I there is somewhere somthing written in the wordpress php file, that is redirecting me to the main domain because I made many changes in the .htaccess file but nothing worked out. 一切都从代码,服务器和托管方面进行设置,但是我面临的问题是,当我在URL中键入任何子域(如“ rj.mysite.com”)时,我在wordpress php文件中写了一些东西,这将我重定向到主域,因为我在.htaccess文件中进行了许多更改,但没有任何结果。

I have tried so much but couldn't found the script that is redirecting the sub-domains to the main domain. 我已经做了很多尝试,但是找不到将子域重定向到主域的脚本。

Can anybody please tell me that what should be there in the php code of WordPress that is redirecting my sub-domains to the main site? 谁能告诉我,将我的子域重定向到主站点的WordPress php代码中应该包含什么?

just found the answer today, hope you've solved it, assuming you have, what i did for mine was create another wp-config.php file, named it wp-config-sub.php, then in your sub domain, require the wp-config-sub.php file, instead of the wp-config.php file, 刚刚找到今天的答案,希望您能解决,假设您已经解决了,我为我所做的就是创建另一个wp-config.php文件,命名为wp-config-sub.php,然后在您的子域中要求wp-config-sub.php文件而不是wp-config.php文件,

    require_once '../wp-config-sub.php';

then go back to your wp-config-sub.php file and comment out these lines 然后回到您的wp-config-sub.php文件并注释掉这些行

/* Multisite */
//define( 'WP_ALLOW_MULTISITE', true );
//define('MULTISITE', true);
//define('SUBDOMAIN_INSTALL', false);
//define('DOMAIN_CURRENT_SITE', 'yoursiteprimaryurl.com');
//define('PATH_CURRENT_SITE', '/');
//define('SITE_ID_CURRENT_SITE', 1);
//define('BLOG_ID_CURRENT_SITE', 1);

hope this will solve your problem. 希望这能解决您的问题。 :) :)

if everything correct in the NS records and the domain redirects I think you need to login to wordpress and change in the general settings 如果NS记录中的所有内容都正确并且域重定向,我认为您需要登录到wordpress并更改常规设置

WordPress Address (URL) and Site Address (URL) WordPress地址(URL)和站点地址(URL)

to your sub domain or to check your .htaccess file 到您的子域或检查您的.htaccess文件

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

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