需求有倆個。
1.http自動跳轉(zhuǎn)https
2.index.php屏蔽掉,thinkphp框架。
Thanks
建議查看相關文檔。http://www.htaccesseditor.com/sc.shtml 這里提供一個可以在線生成的web。
補充:http://hi.baidu.com/honfei/item/0893a6e12984903a4ddcafbc
一,http直接跳轉(zhuǎn)到https
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
二,TP屏蔽index.php
如果是Apache則需要在入口文件的同級添加.htaccess文件,內(nèi)容如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
Nginx環(huán)境
在Nginx低版本中,是不支持PATHINFO的,但是可以通過在Nginx.conf中配置轉(zhuǎn)發(fā)規(guī)則實現(xiàn):
location / { // …..省略部分代碼
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
ThinkPHP手冊上都會有說明,建議仔細看一下 : )