url rewriting - API and "normal" URLs in one Yii2 application -


i have (use) in yii2 application:

  • a standard, seo-like urls, .html @ end (thus 'suffix' => '.html') ,
  • api request (basing on very simple code) without suffix.

so, make application being able serve both http://127.0.0.1/app/site/index.html-like urls , http://127.0.0.1/uslabs/web/user/2-like api calls.

it possible? if so, how should configure urlmanager component this?

i went through "quick start" chapter in "restful web service" section, bring no help. don't use suffixes in examples given there. i'm stuck choice of either 1 or other scheme.

yii has rest url router can use associate controllers, this;

'urlmanager' => [     'enableprettyurl' => true,     'enablestrictparsing' => true,     'showscriptname' => false,     'suffix' => 'html',     'rules' => [         ['class' => 'yii\rest\urlrule',             'controller' => 'api',             'suffix' => null],     ], ] 

see documentation more details


Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -