Answer the question
In order to leave comments, you need to log in
Why does the subdomain not work, redirect to the main page?
Why doesn't my autosubdomain work? More precisely, when opening a link, there is a stupid transfer to the main page ($ main_domain), the output
// SEF dealer page link
function makeDealerLink($id, $dealer_name='', $page='', $canonical=0) {
// subdomain dealer link
global $ads_settings;
$usr = new users();
if($ads_settings['dealer_subdomain'] && $usr->allowStoreBanner($id)) {
$subdomain = $usr->getDealerSubdomain($id);
global $main_domain;
$site_url = "http://".$subdomain.".".$main_domain;
$page_str="";
if($page) $page_str=$page."/";
$dealer_link = $site_url."/".$page_str;
return $dealer_link;
}
// non subdomain dealer link
if($dealer_name) $url_dealer = _urlencode($dealer_name);
else $url_dealer = _urlencode(users::getContactName($id));
global $config_live_site;
$site_url = $config_live_site;
if($canonical) { global $main_domain; $site_url = "http://".$main_domain; }
$page_str="";
if($page) $page_str=$page."/";
$dealer_link=$site_url."/".$id."-".$url_dealer."/".$page_str.$this->links["store"];
return $dealer_link;
}
// SEF dealer page link
function makeUserListingsLink($id, $dealer_name='', $page='', $canonical=0) {
if($dealer_name) $url_dealer = _urlencode($dealer_name);
else $url_dealer = _urlencode(users::getContactName($id));
global $config_live_site;
$site_url = $config_live_site;
if($canonical) { global $main_domain; $site_url = "http://".$main_domain; }
$page_str="";
if($page) $page_str=$page."/";
$dealer_link=$site_url."/".$id."-".$url_dealer."/".$page_str.$this->links["user_listings"];
return $dealer_link;
}
// if seo urls
if($seo_settings['enable_mod_rewrite']) {
global $settings;
$contact_name_field = $settings['contact_name_field'];
if(isset($user[$contact_name_field]) && $user[$contact_name_field])
$paginator->setSeoUrlStr($id."-"._urlencode($user[$contact_name_field]));
else $paginator->setSeoUrlStr($id."-"._urlencode($user['username']));
$paginator->setExcludeArray(array("id"));
}
RewriteCond %{HTTP_HOST} !www.site.ru$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).site.ru [NC]
RewriteRule (.*) %{SCRIPT_FILENAME}?crt_city=%2 [NC,QSA]
RewriteCond %{HTTP_HOST} !subdomain.site.ru$
Answer the question
In order to leave comments, you need to log in
Remove unnecessary TL;DR
tags.
1) Place wardump and exit at key points of the code, see how the execution is going and where it works wrong
2) Open the network panel in chrome and see what headers come to the redirect.
3) Disable/enable redirect directives in xtaxes.
In short, perform a classic debug.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question