Рубрики
Uncategorized

Конфигурация Laravel nginx скрывает индекс. PHP

Автор оригинала: David Wong.

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Вы можете добавить их, чтобы сделать ваши ссылки более элегантными

# Remove the slash at the end, and SEO is more friendly
if (!-d $request_filename)
{
    rewrite ^/(.+)/$ /$1 permanent;
}

# Remove index action
if ($request_uri ~* index/?$)
{
    rewrite ^/(.*)/index/?$ /$1 permanent;
}

# URL rewriting based on laravel rule
if (!-e $request_filename)
{
    rewrite ^/(.*)$ /index.php?/$1 last;
    break;
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   html;
}