Конвертировать nginx conf в файл .htaccess - PullRequest
0 голосов
/ 25 мая 2019

Я настроил существующий расширенный проект Yii2 на сервере Apache.раньше это было на сервере nginx.У меня есть файл nginx.conf.что я хочу преобразовать его в файл .htaccess, чтобы проект работал и на сервере Apache.

Вот код файла nginx.conf

location / {
     index index.php index.html;
     try_files $uri $uri/ /index.php?$args;
} # / location

location /html {
    alias /../../html/;
}
location /api {
    if ( !-e $request_filename ) {
            rewrite ^/api/(.*)$ /api/index.php?$1 last;
    }
}
location /dten {
    if ( !-e $request_filename ) {
            rewrite ^/dten/(.*)$ /dten/index.php?$1 last;
    }
}
location /dten-backend {
    if ( !-e $request_filename ) {
            rewrite ^/dten-backend/(.*)$ /dten-backend/index.php?$1 last;
    }
} 
location /dten-crm {
    if ( !-e $request_filename ) {
        rewrite ^/dten-crm/(.*)$ /dten-crm/index.php?$1 last;
    }
}

Я пробовал это, но этоне работает.

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule / index.php


# Handle the case of backend, skip ([S=1]) the following rule, if current matcheds
RewriteRule ^/dten-backend(/(.*))?$ /dten-backend/$2 [S=1]
...