Only the first page root directory can be accessed, and the other page addresses are 404 Not found. Online search for a half-day URL redirection, URL Rewrite are tried invalid, or redirect too much, for the jump-pit process.
1Location/ {2 #if($http _host!~ "^www\.nginxtest\.com/index\.php$") {3 4 #if(!-f $request _filename) {5# rewrite ^/(. +) $ http://www.nginxtest.com/index.php?$1 last;6# rewrite ^/(. +) $ http://www.nginxtest.com/index.php/$1 break;7 #}8 9 #if($http _host ~* "^ (. *) \.nginxtest\.com$") {Ten#Set$domain $1; One# rewrite ^ (. *) http://www.nginxtest.com/$domain/break; A #} - - #if(-F $request _filename/index.html) { the# rewrite (. *) $1/index.html Break; - #} - #if(-F $request _filename/index.php) { -# rewrite (. *) $1/index.php; + #} - #if(!-f $request _filename) { +# rewrite (. *)/index.php; A #}
atTry_files $uri $uri//index.php?$query _string; - if(!-e $request _filename) { -Rewrite ^/(. *)/index.php last; - } - -}
Finally use this code finally normal, hope also can help everybody
Location/{try_files $uri $uri//index.php? $query _string;if (!-e $request _filename) { rewrite ^/(. *)/index.php Last; }}
Nginx configuration only root directory home index.php can access, other pages 404