Why can't index.php be omitted in domain name access?
kevinchow
kevinchow 2018-03-02 11:36:09
0
9
1954

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?

kevinchow
kevinchow

reply all(5)
Mayukiii733

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

寻觅 beyond

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

  • reply Even after adding .htaccess to the public directory, index.php still cannot be hidden. My environment is phpstudy environment, php7.
    kevinchow author 2018-03-08 10:09:42
寻觅 beyond

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 Can't the entry file be hidden? Teacher Peter in the video can achieve it
    kevinchow author 2018-03-08 10:10:39
雕花笼

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 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 author 2018-03-08 10:12:14
自由飞翔

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

  • reply 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 author 2018-03-08 10:13:47
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!