導航:首頁 > 編程語言 > iis6php偽靜態配置

iis6php偽靜態配置

發布時間:2023-03-07 16:14:19

① 求助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

② php IIS6偽靜態規則HTTPD.INI這個怎麼寫

httpd.ini 編寫格式:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
前四行是固定的,下面開始寫規則
RewriteRule ^index.html$ index\.php [I]
RewriteRule ^news-(.*).html$ news\.php\?id=$1 [I]
#註:(.*) 表示任意字元
RewriteRule ^news-(\d+).html$ news\.php\?id=$1 [I]
#註:(\d+) 表示只能數字
RewriteRule ^(.*)-(\d+).html$ news\.php\?n=$1&id=2 [I]
#註:多參數,偽靜態也可以自定義文件名字+ID號。更加有利於優化。

③ 【緊急】PHP偽靜態設置,幫個忙。。。

RewriteRule ^(.*?).de(.*)$ $1.php$2

閱讀全文

與iis6php偽靜態配置相關的資料

熱點內容
php和類名相同的方法 瀏覽:360
香港台灣dns伺服器地址列表 瀏覽:537
大同app怎麼樣 瀏覽:438
php去掉特殊字元 瀏覽:387
androidapi中文合集 瀏覽:658
win7下安裝linux虛擬機 瀏覽:838
雲主機用別的伺服器嗎 瀏覽:922
黑馬買入指標源碼副圖 瀏覽:962
微軟為什麼會把伺服器放在水底 瀏覽:257
php截取字元串中文 瀏覽:21
虛擬機和編譯軟體哪個好 瀏覽:750
存儲伺服器為什麼比通用伺服器難 瀏覽:373
用php列印出前一天的時間 瀏覽:369
2010編譯方法 瀏覽:239
華為哪裡查看隱藏app 瀏覽:889
linux網卡重置 瀏覽:830
框架柱低於四米箍筋全高加密 瀏覽:694
米二如何安卓版本升級到高安卓版 瀏覽:783
安卓手機數據慢怎麼辦 瀏覽:727
雙底買賣指標公式源碼無未來函數 瀏覽:685