Php framework-thinkphp has problems hiding the index. php and Home modules

Source: Internet
Author: User
I want to hide home and index. php was originally like this {code ...} then I added the configuration file {code ...} the purpose is to hide the index. php and home, but the result is that I am very sad. If you change the configuration file, only {code...} is left ...} can be accessed, and the Home is omitted or only {...

I want to hide home and index. php
This is the case.

http://localhost/index.php/Home/Index/test.html

Then I added the configuration file.

'MODULE_ALLOW_LIST'     =>      array('Home'),'DEFAULT_MODULE'        =>      'Home','URL_MODEL'             =>      '2',

The purpose is to hide index. php and home,

But the result is,

I'm sad,

If you change the configuration file
Keep only

'MODULE_ALLOW_LIST'     =>      array('Home'),'DEFAULT_MODULE'        =>      'Home',

Can be accessed, and the Home

Or keep only

'URL_MODEL'             =>      '2',

It can also be accessed, and Index. php is also omitted.

Why can't I omit Home and index. php at the same time ???

My current environment is apache2.4.18 + php7.0.4

Rewrite: I'm sure it has been enabled. I don't know how to solve this problem.

Is Thinkphp having this problem in apache2.4.18? All others are normal ???

PS :::

1: rewrite enabled.

2: AllowOverride changed All to All.
]

3: I also have the. htaccess file.

4. thinkphp Application/Common/conf/config. php

Reply content:

I want to hide home and index. php
This is the case.

http://localhost/index.php/Home/Index/test.html

Then I added the configuration file.

'MODULE_ALLOW_LIST'     =>      array('Home'),'DEFAULT_MODULE'        =>      'Home','URL_MODEL'             =>      '2',

The purpose is to hide index. php and home,

But the result is,

I'm sad,

If you change the configuration file
Keep only

'MODULE_ALLOW_LIST'     =>      array('Home'),'DEFAULT_MODULE'        =>      'Home',

Can be accessed, and the Home

Or keep only

'URL_MODEL'             =>      '2',

It can also be accessed, and Index. php is also omitted.

Why can't I omit Home and index. php at the same time ???

My current environment is apache2.4.18 + php7.0.4

Rewrite: I'm sure it has been enabled. I don't know how to solve this problem.

Is Thinkphp having this problem in apache2.4.18? All others are normal ???

PS :::

1: rewrite enabled.

2: AllowOverride changed All to All.
]

3: I also have the. htaccess file.

4. thinkphp Application/Common/conf/config. php

Remove index. php

1. The mod_rewrite.so module is loaded in the httpd. conf configuration file. // configure it in APACHE.

LoadModule rewrite_module modules/mod_rewrite.so remove the preceding Alert Code

2. Change AllowOverride None to All // configure AllowOverride in APACHE (note that AllowOverride is set to ALL in other places)

AllowOverride none to AllowOverride ALL
Options None
Order allow, deny
Allow from all

3. Make sure that URL_MODEL is set to 2 and write it in the configuration file of the project.
Return Array (
'Url _ model' => '2 ',
);

4. The htaccess file must be placed in the directory with the link.
In this file, add:

RewriteEngine on
RewriteCond % {REQUEST_FILENAME }! -D
RewriteCond % {REQUEST_FILENAME }! -F
RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.