# Remove index.php$
if ($request_uri ~* "^(.*/)index\.php$") {
return 301 $1;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
# Remove from everywhere index.php
if ($request_uri ~* "^(.*/)index\.php(/?)(.*)") {
return 301 $1$3;
}
}
# Remove trailing slash.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
# Clean Double Slashes
if ($request_uri ~* "\/\/") {
rewrite ^/(.*) /$1 permanent;
}
Forked from slow-is-fast/laravel remove index.php from url.md
Created
January 1, 2022 22:23
-
-
Save Eyad-Bereh/e1ca3adc9c6085e48b078b975307ea62 to your computer and use it in GitHub Desktop.
[nginx] laravel remove index.php from url
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment