導航:首頁 > 編程語言 > 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相關的資料

熱點內容
高盛數字加密 瀏覽:895
軟著網上能不能查到自己的源碼 瀏覽:914
編譯好的android源碼 瀏覽:993
學校機房雲伺服器和電腦主機 瀏覽:10
Python紅色五角星畫法 瀏覽:337
壓縮餅干翻譯 瀏覽:686
macos命令行窗口的樣式 瀏覽:248
androidflipboard 瀏覽:878
投資公司投資源碼 瀏覽:75
python語料訓練 瀏覽:338
武夷岩茶產地溯源碼 瀏覽:383
求生組隊用什麼伺服器最好 瀏覽:24
php回調匿名回調函數 瀏覽:107
源碼翻譯軟體哪裡找 瀏覽:523
邪惡程序員解說 瀏覽:600
醫生找程序員 瀏覽:423
cad三維剖切命令 瀏覽:55
壓縮機的氣能流多遠 瀏覽:85
linuxfdiskt 瀏覽:696
iphone沒有id怎麼用app 瀏覽:983