ThinkPHP在IIS下配置ISAPI伪静态去掉index.php
发布时间:2016-08-09
关于301永久重定向。 RewriteCond Host: ^htmltec\.com$ RewriteRule (.*) http\://www.htmltec\.com$1 关于去掉index.php的方法,网上很多给出配置甚至官网给出的配置都有个问题,无法排除Public、Uploads等静态文件的路径,一股脑全都转交给index.php处理了,导致图片、CSS、JS都读取不到。(当然也有可能是服务器使用的ISAPI版本不一样,反正我用的ISAPI3.1是没有成功过) 后来我参考了别人用的CI框架的重写规则,立马就解决了,具体如下: RewriteRule /(?:index\.php|admin\.php|robots\.txt|favicon\.ico|Uploads|Public)/(.*) $0 顺便给个Apache下的.htaccess配置吧 RewriteEngine On ################# # 域名301重定向 # ################# RewriteCond %{HTTP_HOST} ^htmltec.com RewriteRule ^(.*)$ http://www.htmltec.com/$1 #################### # ThinkPHP rewrite # #################### RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 文章来源
更多文章 进入论坛 我要发帖