導航:首頁 > 編程語言 > iis75偽靜態php

iis75偽靜態php

發布時間:2023-12-27 16:20:25

Ⅰ 求助php偽靜態,如何將動態PHP頁面改為偽靜態頁面

偽靜態實際上就是把 index.php?act=about&cid=1 將這種形式的動態路徑用 about-1.html 這種形式輸出,也就是說瀏覽器每次訪問about-1.html地址能打開相應的index.php?act=about&cid=1動態網址。

偽靜態的實現本質上是配置伺服器進行路徑轉換,根據不同的伺服器環境,配置方法也不太一樣,PHP+iis6的話就要配置httpd.ini文件,php+iis7就要配置web.config,PHP+apache就要配置.htaccess文件(或者httpd.conf)

.htaccess(或者httpd.conf)文件的規則示例:
RewriteEngine on
RewriteRule ^/?(index|guestbook|online)\.html$ index\.php [L]
RewriteRule ^/?(eindex)\.html$ index\.php?act=$1 [L]
RewriteRule ^/?(index|guestbook|online)-([0-9]+).html$ index\.php\?p=$2 [L]
RewriteRule ^/?([a-z0-9]+)_([0-9]+).html$ index\.php\?act=$1&id=$2 [L]
RewriteRule ^/?([a-z0-9]+)-([0-9]+).html$ index\.php\?act=$1&cid=$2 [L]
RewriteRule ^/?([a-z0-9]+)-([0-9]+)-([0-9]+).html$ index\.php\?act=$1&cid=$2&p=$3 [L]

httpd.ini示例:
[ISAPI_Rewrite]
RepeatLimit 32
# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]
RewriteRule ^/(index|guestbook|online)\.html$ /$1\.php
RewriteRule ^/(eindex).html$ /index\.php\?act=$1
RewriteRule ^/(index|guestbook|online)-([0-9]+).html$ /$1\.php\?p=$2
RewriteRule ^/([a-z0-9]+)_([0-9]+).html$ /index\.php\?act=$1&id=$2
RewriteRule ^/([a-z0-9]+)-([0-9]+).html$ /index\.php\?act=$1&cid=$2
RewriteRule ^/([a-z0-9]+)-([0-9]+)-([0-9]+).html$ /index\.php\?act=$1&cid=$2&p=$3

Ⅱ IIS 伺服器下的PHP偽靜態要怎麼弄啊

IIS配置支持偽靜態 ISAPI Rewrite(win2003系統)

第一:首先我們需要下載一個ISAPI_Rewrite,有精簡版和完全版,一般精簡版只能對伺服器全局進行配置,而完整版可以對伺服器上的各個網站進行偽靜態配置.對於個人站長來說,精簡版就足夠了.

下載:http://www.isapirewrite.com/download/isapi_rwl_0055.msi

第二:下載完成後,可以找到安裝包里的.msi的文件,安裝即可.

隨便裝在哪都可以,默認是裝在C:\Program Files\Helicon下,要注意的是這個目錄everyone要有讀取許可權。我就因為當時伺服器許可權配的比較嚴格,默認安裝Helicon這目錄EVERYONE是沒有任何許可權的,結果老是出現:Service Unavailable 。

第三:打開Internet 信息服務,右鍵,web站點屬性,點擊ISAPI篩選器選項卡.添加篩選器,這里的名稱可以自己隨意填寫,路徑自己指定ISAPI_Rewrite.dll,然後確定.

下面我們先做一個測試頁new.asp,可以按照下面的代碼寫

然後,在瀏覽器中輸入:

http://127.0.0.1/new.asp?id=1234

接著你就可以在網頁上看到一行文字:"1234"

看到這幾個數字,就說明你測試成功了.

現在我們開始來配置ISAPI_Rewrite :

打開ISAPI_Rewrite的目錄,把httpd.ini的只讀屬性去掉,打開編輯.我們現在是需要把new.asp?id=1234修改成類似new_1234.html的路徑,因此,我們需要在httpd.ini中添加一句

RewriteRule /new_([0-9,a-z]*).html /new.asp?id={GetProperty(Content)}

保存後,我們就可以測試一下這個網址了:http://127.0.0.1/new_1234.html

可以看到頁面上的"1234"了吧,就這樣偽靜態配置成功了!

閱讀全文

與iis75偽靜態php相關的資料

熱點內容
磁力計校正演算法 瀏覽:491
解壓縮後變小了 瀏覽:957
智友文件夾 瀏覽:81
android操作系統開發的操作系統 瀏覽:478
原神手機怎麼改b站伺服器 瀏覽:296
樁基箍筋加密區高度規范 瀏覽:91
手機櫻花動漫app怎麼用 瀏覽:382
php科學計數法轉換 瀏覽:642
sip認證演算法 瀏覽:785
androidapp卡頓原因 瀏覽:905
25編程器電路 瀏覽:849
安卓九是什麼東西 瀏覽:939
隱藏nodejs命令行窗口 瀏覽:62
人體與寫生素描pdf 瀏覽:883
java集合性能 瀏覽:143
單片機三線通信 瀏覽:209
崑山ug編程培訓學費 瀏覽:628
黃色app怎麼盈利的 瀏覽:957
怎麼修改linux密碼 瀏覽:703
國家發展中心app長什麼樣子 瀏覽:242