Discuz mobile version modify the default home page

Original link:https://muyexi.im/discuzshou-ji-ban-xiu-gai-mo-ren-zhu-ye/

When opening the Discuz! X3.4 forum mobile home page, it will automatically jump to the forum page ( /forum.php?forumlist=1&mobile=2 ) instead of the home page ( /forum.php?mod=guide&view=new&mobile=2 ).

Open the management center – global – domain name settings – application domain name, the mobile phone domain name is indeed the forum page, try to modify it, and always report an error:

Please fill in a valid domain name. Common mistakes are that it starts with “http://”, “.” or ends with “/”, “/index.php”, “.”, or the domain name contains internationalization that is not converted to Punycode domain name, etc.

I had to directly modify the field corresponding to “Mobile Version” in the data table pre_common_nav , but this only fixed the “Mobile Version” link at the bottom of the page.

After retrieval, it is found that the code that controls the page jump is in the following location in the source/class/discuz/discuz_application.php file:

 if(strpos($this->var['setting']['domain']['defaultindex'], CURSCRIPT) !== false && CURSCRIPT != 'forum' && !$_GET['mod']) { if($this->var['setting']['domain']['app']['mobile']) { $mobileurl = $this->var['scheme'].'://'.$this->var['setting']['domain']['app']['mobile']; } else { if($this->var['setting']['domain']['app']['forum']) { $mobileurl = $this->var['scheme'].'://'.$this->var['setting']['domain']['app']['forum'].'?mobile=yes'; } else { $mobileurl = $this->var['siteurl'].'forum.php?mobile=yes'; } } # Fix Default Mobile Homepage: https://codetreasures.com/blog/detail/3TxqyIpZ0v $mobileurl = "https://www.YOUR-DOMAIN.com/forum.php?mod=guide&view=new&mobile=2"; if(!$this->var['setting']['mobile']['otherindex']){ dheader("location:$mobileurl"); } }

You can directly modify the $mobileurl here.

This article is reproduced from:https://muyexi.im/discuzshou-ji-ban-xiu-gai-mo-ren-zhu-ye/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment