海洋cms演员默认是动态URL,原URL格式:
/search.php?searchword=汤唯
修改后的URL格式:
/zhuyan/汤唯
伪静态修改步骤:
1、复制根目录的search.php,并重命名为zhuyan.php,然后修改此文件的内容:
$searchTemplatePath = "/templets/".$GLOBALS['cfg_df_style']."/".$GLOBALS['cfg_df_html']."/search.html";
修改为:
$searchTemplatePath = "/templets/".$GLOBALS['cfg_df_style']."/".$GLOBALS['cfg_df_html']."/zhuyan.html";
2、为主演电影合集页面制作一个单独的模板,并命名为:zhuyan.html,或者直接复站内模板search.html,然后修改成zhuyan.html;
3、修改程序:/include/common.func.php,找到代码:
function getKeywordsList($key,$span){ if($key=='')return $key; $keyWordsStr=""; $keystr=str_replace(",",",",$key); if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);} for($kli=0;$kli<count($keyWordsArray);$kli++){ $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."search.php?searchword=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span; } return $keyWordsStr; }
修改为:
function getKeywordsList($key,$span){ if($key=='')return $key; $keyWordsStr=""; $keystr=str_replace(",",",",$key); if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);} for($kli=0;$kli<count($keyWordsArray);$kli++){ $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."zhuyan/".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span; } return $keyWordsStr; }
伪静态规则:
web.config规则:
<rule name="已导入的规则 1-1"> <match url="zhuyan/(.+?)$" ignoreCase="false" /> <action type="Rewrite" url="zhuyan.php?searchword={R:1}" appendQueryString="false" /> </rule>
http.ini规则:
#zhuyan RewriteRule ^(.*)/zhuyan/(.+?)$ $1/search.php?searchword=$2
.htaccess规则:
#zhuyan RewriteRule zhuyan/(.+?)$ zhuyan.php?searchword=$1
修改完成后,在内容页中查看演员的URL地址就会变成伪静态的格式,而不是之前的动态搜索的格式!
注意:zhuyan目录可以自由修改为任意名称。各位网友如有更好的解决方法,欢迎交流!