為什么我的按照老師的放到index文件下訪問的時(shí)候路徑變成這樣才能訪問?
http://tp6.com/index.php/index/index/admin
這里說的入口文件指的是公共/ index.php文件,配置文件就在這個(gè)目錄下可以去掉URL地址里面的入口文件index.php,但是需要額外配置WEB服務(wù)器的重寫規(guī)則。以Apache為例,在需要文件入口的同級(jí)添加.htaccess文件(官方默認(rèn)自帶了該文件),內(nèi)容如下:
<IfModule?mod_rewrite.c> Options?+FollowSymlinks?-Multiviews RewriteEngine?on RewriteCond?%{REQUEST_FILENAME}?!-d RewriteCond?%{REQUEST_FILENAME}?!-f RewriteRule?^(.*)$?index.php/?[QSA,PT,L] </IfModule> 如果用的phpstudy,規(guī)則如下: <IfModule?mod_rewrite.c> ?Options?+FollowSymlinks?-Multiviews ?RewriteEngine?on?RewriteCond?%{REQUEST_FILENAME}?!-d ?RewriteCond?%{REQUEST_FILENAME}?!-f ?RewriteRule?^(.*)$?index.php?[L,E=PATH_INFO:]? ?</IfModule>