How to modify Discuz! Mobile access portal.php? mobile = 2 is the home page

discuz! Many forum users only have the forum function turned on in the background, but not the portal function. When users visit the mobile terminal, they directly jump to forum.php? mobile=2 is the home page, while some users have portal.php? mobile=2. Some user requirements are that when you want to access a domain name, you can directly portal.php? Mobile=2 is the home page, and the following is the revised tutorial, which will be adjusted according to your actual needs.
Via URL rewrite (server support required)
Applies to Apache (.htaccess)
Add rules to the.htaccess in the root directory of the website:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (mobile|android|iphone|ipad|phone) [NC]
RewriteRule ^$ /portal.php? mobile=2 [L,R=302]
Available for Nginx
Add to site configuration:
if ($http_user_agent ~* "mobile|android|iphone|ipad|phone") {
rewrite ^/$ /portal.php? mobile=2 permanent;}
© Website copyright and disclaimer
1.[honmau Media] independently owns the copyright of all materials on relevant pages of this website;
2. No one is allowed to copy it without the express written permission of [honmau Media];
3. The articles that do not indicate "honmau Media" on this website are all from the Internet and are only for everyone to learn and refer;
4. If there is any infringement/violation/irregularity, please contact customer service QQ or email to delete it, please understand;
5.[honmau Media] reserves the right to correct, modify and update this statement at any time.legal notice