有的win主機IIS不支援 .htaccess 檔案, 我在這裡指的不是本地 在本地的話用apmserv伺服器可以用.htaccess 檔案,用apmserv伺服器環境配置偽靜態可以看 php 偽靜態 (url rewrite mod_rewrite 重寫) 這篇文章,講的很詳細.
這裡我們主要講解httpd.ini 廢話不說直接看效果~
例: www.jb51.net/index.php
我們想讓他用 www.jb51.net/index.html 來直接存取
www.jb51.net/newxx.php?=10 [newxx.php 是新聞的詳細頁面]
我們把他偽靜態成為 www.jb51.net/new-10.html
實現過程如下:httpd.ini 的源檔案
[ISAPI_Rewrite]
# 3600 = 1 hour
# CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^/httpd(?:\.ini|\.parse\.errors).* [F,I,O]
RewriteRule /index.html /index.php
RewriteRule /new-([0-9]+).html$ /newxx\.php\?uid=$1上面的例子可以看出 RewriteRule /index.html /index.php 是把index.php 轉換為 index.html
RewriteRule /new-([0-9]+).html$ /newxx\.php\?uid=$1 轉換為 new-10{這個10為id=幾的值}.html
很簡單吧。 這種偽靜態一般 win主機的空間商基本都支援的!
http://www.bkjia.com/PHPjc/779160.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/779160.htmlTechArticle有的win主機IIS不支援 .htaccess 檔案, 我在這裡指的不是本地 在本地的話用apmserv伺服器可以用.htaccess 檔案,用apmserv伺服器環境配置偽靜態可...