1. 程式人生 > >ThinkPHP部署在IIS,Apache伺服器上的rewrite模式的配置檔案

ThinkPHP部署在IIS,Apache伺服器上的rewrite模式的配置檔案

1.IIS伺服器的配置檔案
1.1 web.Config 檔案的配置

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="OrgPage" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions
logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions> <action type="Rewrite" url="index.php/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

2.Apache 伺服器的配置檔案
2.1 .htaccess 檔案的配置

<IfModule mod_rewrite.c>
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>

ThinkPHP專案地址: