phpcms伪静态设置(linux和windows2种方法)
linux+apache
文件位置:网站主目录 .htaccess
内容可参考:
<FilesMatch "\.(bak|inc|lib|sh|tpl|lbi|dwt)$"> order deny,allow Allow from all </FilesMatch> <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^content-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3 RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$1&page=$2 </IfModule>
windows+iis
文件位置:网站主目录 web.config
内容可参考:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="已导入的规则 1">
<match url="^content-([0-9]+)-([0-9]+)-([0-9]+).html" ignoreCase="false" />
<action type="Rewrite" url="index.php?m=content&c=index&a=show&catid={R:1}&id={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="已导入的规则 2">
<match url="^show-([0-9]+)-([0-9]+)-([0-9]+).html" ignoreCase="false" />
<action type="Rewrite" url="index.php?m=content&c=index&a=show&catid={R:1}&id={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="已导入的规则 3">
<match url="^list-([0-9]+)-([0-9]+).html" ignoreCase="false" />
<action type="Rewrite" url="index.php?m=content&c=index&a=lists&catid={R:1}&page={R:2}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration> 本文出自:琅枫个人博客。如需转载请注明出处!
本文出处:"https://www.langfujun.top/learn/php/63.html"
如果您觉得文章对你有帮助,可以进行打赏。
打赏多少,您高兴就行,谢谢您对琅枫博客的支持! ~(@^_^@)~
微信打赏
支付宝打赏