Thinkphp5 url access issu

http://localhost:8888/thinkphp_5.0.20/public/index.php

1. The above link can be accessed, but the following link cannot be accessed. The source code just downloaded

http://localhost:8888/thinkphp_5.0.20/public/index.php/index/Index/index

2. How to simplify access to url, for example, without adding index.php
http://localhost:8888/thinkphp_5.0.20/index/index/index

Mar.24,2021

the following configuration by server type can ignore the .htaccess configuration under index.php
Apache: public:

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>

Nginx.conf: of Nginx

location / { // ..
   if (!-e $request_filename) {
   rewrite  ^(.*)$  /index.php?s=/$1  last;
   break;
    }
 }

this is my configuration file, for reference only:

  server {
    server_name www.phpyd.com;
    access_log /data/wwwlogs/access_myfast.log combined;
    root /data/wwwroot/myfastadmin/public;
    index index.html index.htm index.php;
    -sharperror_page 404 /404.html;
    -sharperror_page 502 /502.html;
    location /nginx_status {
      stub_status on;
      access_log off;
      allow 127.0.0.1;
      deny all;
    }
    location ~ [^/]\.php(/|$) {
      -sharpfastcgi_pass 127.0.0.1:9000;
      fastcgi_pass unix:/dev/shm/php-cgi.sock;
      fastcgi_index index.php;
      include fastcgi.conf;

      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_param   PATH_INFO   $fastcgi_path_info;
      fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
      expires 30d;
      access_log off;
    }
    location ~ .*\.(js|css)?$ {
      expires 7d;
      access_log off;
    }
    location ~ /\.ht {
      deny all;
    }
    location ~* \.(eot|ttf|woff|svg|otf)$ {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
    }

    if (!-e $request_filename){
        rewrite  ^(.*)$  /index.php?s=$1  last;
        break;
     }
  }

/ public/index.php/index/Index/index
cannot be accessed, you turn on debug mode to see what error is reported, module, controller, or operation does not exist?

for the problem of simplifying url, see the documentation in the url rewrite section.

Menu