Why does the path change when I put it under the index file to access it according to the teacher's instructions?
http://tp6.com/index.php/index/index/admin
WJ2020-05-20 09:27:52
The entry file mentioned here refers to the public/index.php file. The configuration file is in this directory. You can remove the entry file index.php in the URL address, but you need to configure the rewrite rules of the WEB server additionally. Taking Apache as an example, add the .htaccess file at the same level that requires file entry (the official file comes with it by default), with the following content:
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/ [QSA,PT,L] </IfModule> 如果用的phpstudy,规则如下: <IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:] </IfModule>