YII2.0 Restful API 记得配置服务器重写规则哦

<VirtualHost *:80>
ServerName api.apitpl.dev
DocumentRoot "/Users/michaelweixi/WWWRoot/apitpl/api/web/"

<Directory "/Users/michaelweixi/WWWRoot/apitpl/api/web/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php

# use index.php as index file
DirectoryIndex index.php

# ...other settings...
</Directory>
</VirtualHost>

 

posted @ 2018-01-22 22:14  iceman!  阅读(224)  评论(0编辑  收藏  举报