Home  >  Q&A  >  body text

Why can't index.php be omitted in domain name access?

Why can’t index.php be omitted in domain name access? For example: http://tp5.com/index.php/index/index/index. If index.php is omitted, it cannot be accessed. How to modify it?

kevinchowkevinchow2446 days ago1950

reply all(9)I'll reply

  • Mayukiii733

    Mayukiii733 2019-12-20 23:09:09

    Change the last line RewriteRule in the .htaccess file in the Public folder to RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] to hide the entry file

    reply
    0
  • 寻觅 beyond

    寻觅 beyond2018-03-04 14:36:05

    As mentioned on the first floor, if you want to omit index.php, you need to configure url rewriting and add .htaccess

    reply
    0
  • kevinchow

    Even after adding .htaccess to the public directory, index.php still cannot be hidden. My environment is phpstudy environment, php7.

    kevinchow · 2018-03-08 10:09:42
  • 寻觅 beyond

    寻觅 beyond2018-03-04 14:34:26

    This is the reason for the framework. index.php is the entry file. As you can understand from the name, all requests to this website must first go through this script

    reply
    0
  • kevinchow

    Can't the entry file be hidden? Teacher Peter in the video can achieve it

    kevinchow · 2018-03-08 10:10:39
  • 雕花笼

    雕花笼2018-03-02 14:30:40

    Is the index file index.php? If not, check whether it exists and its priority.

    During routing processing, when $_SERVER['PATHINFO'] does not exist, are the default controller set to index and the default method set to index?

    reply
    0
  • kevinchow

    I downloaded thinkphp5.0.15 and did nothing. I checked the .htaccess file in the public directory and it was normal, but it couldn’t be hidden.

    kevinchow · 2018-03-08 10:12:14
  • 自由飞翔

    自由飞翔2018-03-02 14:02:12

    Through url rewriting, the server usually needs to enable the url_rewrite module to support

    reply
    0
  • kevinchow

    I haven’t reached the routing yet. I can’t use the .htaccess file to achieve it. But I can achieve it in the video. I checked the manual and found that in the Apache configuration, there is no configuration item in studyphp.

    kevinchow · 2018-03-08 10:13:47
  • Cancelreply