本站在linux空间下编写的.htaccess文件采用Thinkphp官方文档,代码如下: | <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
|
本站在windows2003以下的服务器空间编写的Httpd.ini文件代码如下: | [ISAPI_Rewrite]
CacheClockRate 3600
RepeatLimit 32
RewriteRule /(?!Public)(?!include)(?!Uploads)(.*) /index.php\//$1 [L]
|
注:(?!Public) 是指这些文件夹不需要进行伪静态,因为这些路径是保存图片和css、js文件的。 本站在windows2008的服务器使用以下代码,保存的文件名为web.config 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| <?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>
|
根据不同的空间,请将上面的伪静态规则,保存为.htaccesss文件或Httpd.ini或web.config文件,并放到ThinkPHP项目入口文件同级目录下。 hinkPHP要修改数据库配置(config.php)文件使网站支持url重写功能,配置代码: | 'URL_MODEL'=>2,//兼容模式 不支持伪静态时用,支持则改为2
大米的话 就是在web -- conf --config.php 修改以上参数
|
|