Remove index.php from url nginx laravel
В категорії Підказки от 20 Червня, 2023. Автор adminВидалення index.php з любої частини URL
server {
root /var/www/*** index index.php;
server_name mywebsite.com;
if ($request_uri ~* "^(.*/)index\.php/*(.*)")
{ return 301 $1$2; }
….
Приклад того, що буде з URL :
mywebsite.com/index.php => mywebsite.com/
mywebsite.com/index.php?q=query => mywebsite.com/?q=query
mywebsite.com/index.php/article => mywebsite.com/article
mywebsite.com/index.php/article/ => mywebsite.com/article/
mywebsite.com/folder/index.php => mywebsite.com/folder/
mywebsite.com/folder/index.php?q=query => mywebsite.com/folder/?q=query
mywebsite.com/folder/index.php/article => mywebsite.com/folder/article
mywebsite.com/folder/index.php/article/ => mywebsite.com/folder/article/