1.将public下的文件.htaccess文件代码修改如下 : 在index.php加问号?即可
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
接口路由配置 :
这样我们由原先的路径
http://api.test-api.com/index.php/api/user
改为
http://api.test-api.com/api/user
补充:关于api 路由编写配置:api.test-api.com/user/index
1.app下的config.php里 设置开启为true ->即将路由开启!!
// 是否开启路由
'url_route_on' => true,
2.app下的route.php里
// api.test-api.com => www.test-api.com/index.php/api
//
Route::domain('api','api');
// api.test-api.com/user/2 => www.test-api.com/index.php/api/user/index/id/2
Route::rule('user/:id','user/index');
Route::rule('/','index/index/index');
形如: