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

phpiis6偽靜態配置

發布時間:2025-03-09 15:51:20

『壹』 求助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

閱讀全文

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

熱點內容
雲伺服器研發費用明細 瀏覽:957
unity3d手機游戲開發pdf 瀏覽:366
mysql重啟命令linux 瀏覽:876
程序員日常業余內容 瀏覽:363
steam如何更改吃雞伺服器 瀏覽:212
我的世界up主多人用什麼伺服器 瀏覽:161
縫紉機電腦機編程 瀏覽:59
autowired源碼深度解析 瀏覽:895
校園卡怎麼上app 瀏覽:743
pascal高精度演算法 瀏覽:870
阿里雲伺服器如何修改php 瀏覽:8
51單片機小項目 瀏覽:607
為什麼d盤e盤無法解壓 瀏覽:314
軟體放文件夾壓縮以後會變小嗎 瀏覽:669
文件夾中的圖片怎麼整體壓縮 瀏覽:579
程序員那麼可愛媽媽是誰演的 瀏覽:799
密碼反編譯在線 瀏覽:4
php學習小結 瀏覽:13
2019考研英語紅寶書pdf 瀏覽:395
宋代科舉pdf 瀏覽:24