使用偽靜態不用大量生成靜態html文件,當網頁量非常多的時候,生成會很花時間,而且非常占硬盤空間,產生很多I/O開銷,因此不如使用動態的,但是動態的url對搜索引擎不友好,搜索引擎蜘蛛對網址帶有問號的url不進行收錄,偽靜態對于搜索引擎來說就是靜態的.
那么phpcms如何設置偽靜態?
和wordpress等其他程序設置偽靜態一樣,采用程序路由控制,或者htcaccess寫重寫規則.
phpcms可以采取htcaccess寫重寫規則,代碼如下:
- 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
只需上傳htcaccess重寫規則文件到www根目錄就行了.
這樣訪問www.49028c.com/show-1-1-1.html就是rewite到了www.49028c.com /index.php?m=content&c=index&a=show&catid=1&id=1&page=1了,訪問動態網址也可以訪問.
新聞熱點
疑難解答