ThinkPHP在不同系統(tǒng)下的偽靜態(tài)規(guī)則匯總
2023-10-17 22:12 作者:bili_47741569589 | 我要投稿
在建企業(yè)網(wǎng)站時(shí)離不了CMS系統(tǒng),其中基于ThinkPHP(TP)框架的系統(tǒng)占絕大多數(shù)。ThinkPHP是一個(gè)快速、兼容而且簡單的輕量級國產(chǎn)PHP開發(fā)框架,誕生于2006年初,原名FCS,2007年元旦正式更名為ThinkPHP,遵循Apache2開源協(xié)議發(fā)布,從Struts結(jié)構(gòu)移植過來并做了改進(jìn)和完善,同時(shí)也借鑒了國外很多優(yōu)秀的框架和模式,使用面向?qū)ο蟮拈_發(fā)結(jié)構(gòu)和MVC模式,融合了Struts的思想和TagLib(標(biāo)簽庫)、RoR的ORM映射和ActiveRecord模式。
一、在Nginx下的偽靜態(tài)規(guī)則,一般命名Nginx.conf
location?/?{ ???if?(!-e?$request_filename)?{ ???rewrite??^(.*)$??/index.php?s=/$1??last; ???break; ????} ?}
二、在Apache下的偽靜態(tài)規(guī)則, 一般命名.htaccess
<IfModule?mod_rewrite.c> ??Options?+FollowSymlinks?-Multiviews ??RewriteEngine?On ??RewriteCond?%{REQUEST_FILENAME}?!-d ??RewriteCond?%{REQUEST_FILENAME}?!-f ??RewriteRule?^(.*)$?index.php?s=$1?[QSA,PT,L] </IfModule>
三、在Windows的IIS下的偽靜態(tài)規(guī)則,一般命名web.Config
<?xml?version="1.0"?encoding="UTF-8"?> <configuration> ????<system.webServer> ????????<rewrite> ????????????<rules> ????????????????<rule?name="OrgPage"?stopProcessing="true"> ????????????????????<match?url="^(.*)$"?></match> ????????????????????<conditions?logicalGrouping="MatchAll"> ????????????????????????<add?input="{HTTP_HOST}"?pattern="^(.*)$"?></add> ????????????????????????<add?input="{REQUEST_FILENAME}"?matchType="IsFile"?negate="true"?></add> ????????????????????????<add?input="{REQUEST_FILENAME}"?matchType="IsDirectory"?negate="true"?></add> ????????????????????</conditions> ????????????????????<action?type="Rewrite"?url="index.php/{R:1}"?></action> ????????????????</rule> ????????????</rules> ????????</rewrite> ????</system.webServer> </configuration>
標(biāo)簽: