Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the pseudo-static of the home page of phpcms mobile station

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article uses easy-to-understand examples to introduce how to set up the pseudo-static on the home page of the phpcms mobile station, the code is very detailed, interested friends can refer to, hope to be helpful to you.

The method of setting pseudo-static on the home page of phpcms mobile station:

1. Open / phpcms/modules/wap/functions/global.func.php

Find the two functions inside, such as the commented out line of code shown in the following figure, and add a line of code below.

Function list_url ($typeid) {# return WAP_SITEURL. "& a=lists&typeid=$typeid"; return "/ list-$typeid". '.html';} function show_url ($catid, $id, $typeid='') {global $WAP;if ($typeid=='') {$types = getcache ('wap_type','wap'); foreach ($types as $type) {if ($type [' cat'] = $catid) {$typeid=$type ['typeid']; break }} # return WAP_SITEURL. "& a=show&catid=$catid&typeid=$typeid&id=$id"; return "/ show-$catid-$typeid-$id-1". '.html';}

2. Open / phpcms/modules/wap/index.php

Find line 59, the commented out line shown in the following figure, and add a line of code below.

# define ('URLRULE',' index.php?m=wap&c=index&a=lists&typeid= {$typeid} ~ index.php?m=wap&c=index&a=lists&typeid= {$typeid} & page= {$page}'); define ('URLRULE',' list- {$typeid} .html ~ list- {$typeid}-{$page} .html')

3. Add pseudo-static rules

I use an apache server, set the apache server to support .htaccess files, create .htaccess files in the root directory of the website, and add code to it:

RewriteEngine On

RewriteRule ^ list- ([0-9] +)-([0-9] +) index.php?&a=lists&typeid=$1&page=$2RewriteRule ^ list- ([0-9] +) index.php?&a=lists&typeid=$1;RewriteRule ^ show- ([0-9] +)-([0-9] +)-([0-9] +) index.php?a=show&catid=$1&typeid=$2&id=$3

In this way, the phpcms mobile station becomes pseudo-static.

How to set up and create your own Baidu, the method is relatively simple, so I won't go into details here.

In the case of a nginx server, the rewriting rule is written as follows:

Rewrite ^ / list- ([0-9] +). Html / index.php?&a=lists&typeid=$1 last;rewrite ^ / show- ([0-9] +)-([0-9] +)-([0-9] +)-1.html / index.php?a=show&catid=$1&typeid=$2&id=$3 last; on how to set pseudo-static on the home page of the phpcms mobile station is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report