This is my folder structure
-api
-config
main.php
-web
.htaccess
-backend
-config
main.php
-web
.htaccess
-frontend
-config
main.php
-web
.htaccess
in my api/main.php
I enabled pretty url. This is my url manager
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
[
'class' => 'yii\rest\UrlRule',
'controller' => [
'user',
'site'
],
'extraPatterns' => [
'POST,OPTIONS search' => 'search',
'GET site/error'=>'error'
]
],
],
],
and I configured my api/web/.htaccess
also
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
but for every url I am getting the default site/index
result. When I remove pretty url code it is working also code it is working in my local,but not working in my server. Do I need to change anything in .htaccess ?
my yii-app url in server is like www.servername/my-yii-app/api/web
. Any idea?