常見(jiàn)的(de)幾款虛機(jī)僞靜(jìng)态配置"©→£方法
僞靜(jìng)态配置
标簽作(zuò)用(yòng):配置程序僞靜(jìng)态後URL中将不(b$₹λ→ù)再包含兼容模式的(de)問(wèn)号,整個λ ∑(gè)地(dì)址更美(měi)觀,也(yě)便于推廣↕↕'優化(huà)。
适用(yòng)版本:2.X 、3.X
1、IIS7+環境(IIS6的(de)環境自(zì)行(xíng)百 &§↕度):
1)安裝rewrite組件(jiàn),如(rú)果使用®₹©(yòng)空(kōng)間(jiān)一©••(yī)般空(kōng)間(jiān)商默認已經安裝;
2)到(dào)後台配置參數(shù)中開(kāi₹↓×)啓僞靜(jìng)态開(kāi)關;
3)在站(zhàn)點目錄建立web.confi≈©g文(wén)件(jiàn)(可(kě)到(dào)源碼包rewrite ∑目錄下(xià)拷貝規則),規則內(nèi)容如(rú)下(xiδ•↕™à):
<?xml version="1.0&quo₩™§t; encoding="UTF-8"?×≤>
<configuration>×↑€
&nbs∞☆™¥p;<system.webServer>
&nbs<★p; &nb×≠sp;<rewrite>
&nΩ§bsp; &nb>>€sp; ♦>∏₽ <rules>
&nb↓ ±♠sp; &nb∞εsp; &nbs$₹ p; &Ω♣©nbsp; &l$¥β•t;rule name="reIndex&quoσ¥t; stopProcessing=&quoλ✘ ¶t;true">
&nbs<∞ Ωp;  > γ; &nα bsp; ≠§  ≥; <match&n± ₽£bsp;url="^(.*)$" •"ignoreCase="true"&nbs₽✘±₹p;/>
 ≈±; &®®nbsp; &$δ>γnbsp; &δ$ nbsp; <conditions&nb♥↔sp;logicalGrouping="MatchA≈>ll">
&n↓←αbsp; &♦<σnbsp; $©¶∑ &n™€≠©bsp;  ↑&; &↓☆™≥lt;add input=&qu₽♣§αot;{REQUEST_FILENAME π}" matchType="®₩©♦;IsDirectory" negate=&quo↑t;true" />
&n♣← ∞bsp;  ÷≥€®; &nε↑↕bsp; &n←↑Ωbsp;  ↔§♦; $¶∞↓<add input="{REQ£βUEST_FILENAME}" matchType=∏δ¥σ"IsFile" negate=&q€ ÷uot;true" />
 ∏↔; &n≤→♠bsp;  αε§; &n÷ ÷₩bsp; <≠φΩ/conditions>
&nb•€✘sp; &nb×<∏sp; &nbs≈↔γ±p;  >>∑; <action typeα✔="Rewrite" ∑±© url="index.php?p={R:1}&quβ≠ ®ot; appendQueryString="&';true" />
&nλ✘bsp; &π↓≠♦nbsp; &π⥩nbsp; Ω∞₩</rule>
&nbs≠"•p; &nb≥$sp; </rules<♣ >
&σ₩¥nbsp; '×</rewrite>
&n♦§™→bsp; ÷↕×</system.webServer>
<σ$;/configuration>2、Apache環境
1)開(kāi)啓Apache重寫模塊,具體α€(tǐ)請(qǐng)百度,如(rú)果使用(yòng)空(kōng)÷λ∑↔間(jiān)一(yī)般空(kōng)間£σλ(jiān)商默認已經開(kāi)啓;
2)到(dào)後台配置參數(shù)中開(kā•λi)啓僞靜(jìng)态開(kāi)關;↕§§
3)在站(zhàn)點目錄建立.htaccess文(wén)件λ<(jiàn)(可(kě)到(dào)源碼包rew©₽∑×rite目錄下(xià)拷貝規則),規則內(nèi)容如(rú)下(xià)♠§≥:
<IfModule mod_rewrite.c'σ®Ω>
Options +F©π™ollowSymlinks
&α÷∑nbsp;RewriteEngine ∑↕;On
Rewr↔♥©iteCond %{REQUEST_FILENAME}&nbs✔₩p;!-d
RewriteCond&nbs↓p;%{REQUEST_FILENAME} !-f
 "$×±;
R™•♣ewriteRule ^(.*)$&nbγ÷¶δsp;index.php?p=$1&nbsφ→ p;[QSA,PT,L]
</IfModuγle>3、Nginx環境
1、到(dào)後台配置參數(shù)中開(kāi)啓僞靜(jìng)态;
2、在nginx虛拟主機(jī)location配置中添加規則,規則如(®✔rú)下(xià):
location / {
if&nb≈✔δ§sp;(!-e $request_filename) ≠{
&nbsφ↑₽ p; rewrite ^/index.×₽>↓php(.*)$ /index.php?p=$1∏¶♠¥ last;
&™Ωnbsp;  ★γ; rewrite±≠ ^(.*)$ /index.php?s=$1 "♠÷Ωlast;
}
}注意:Nginx中如(rú)果站(zhàn)點部署在二級目£↓錄,請(qǐng)對(duì)應修改重寫規則, 如(rú) ≥:二級目錄為(wèi)test則:rewrite ^/test/ ≠(.*)$ /test/index.php?p=$1 last;
文(wén)章(zhāng)轉載自(zì):https://www.pbootcms.coπγ↔m/docs/239.html
400電(diàn)話(huà)辦理(lǐ)