diff --git a/Nginx/Server Blocks/journal.libraryofcode.org.conf b/Nginx/Server Blocks/journal.libraryofcode.org.conf index 1503034..2418ef3 100644 --- a/Nginx/Server Blocks/journal.libraryofcode.org.conf +++ b/Nginx/Server Blocks/journal.libraryofcode.org.conf @@ -17,11 +17,37 @@ server { charset utf-8; - location / { - #try_files $uri $uri/ /index.php?$query_string; - try_files $uri $uri/ /index.php?$args; + TiBian + Posted 4 years ago # + + Here is what I use and is working perfect. + + # 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; + } + + location = /favicon.ico { access_log off; log_not_found off;