The effect I want to achieve is simple, I have two modules, home, WeChat.
Http://localhost/index.php/home/index/index shortened to: Http://localhost/index/index
Http://localhost/index.php/wechat/index/index shortened to: Http://localhost/wechat/index/index
Hide index.php, this is relatively simple, I open. htaccess support on the line, the specific configuration of the implementation of Baidu Bar, I use the apache2, to establish a soft connection into
Ln-s/etc/apache2/mods-available/rewrite.load/etc/apache2/mods-enabled/rewrite.load
Restart Service
Then, without doing anything, index.php is hidden.
<ifmodule mod_rewrite.c>
rewriteengine on
rewritecond%{request_filename}!-d
Rewritecond%{ Request_filename}!-f
rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]
</IfModule>
This is the thinkphp default. htaccess file content, as you can see, index.php can already be omitted
Then there is the hidden home, and if we write home directly in the. htaccess file, then the other modules will be inaccessible to us, only using the mechanism provided by thinkphp
There's a lot of talk here, but I've found that most of them are telling the whole story.
That's my way of doing it.
Add Configuration to Common/conf/config.php
' Default_module ' => ' home ',
' module_allow_list ' => Array (' Home ', ' WeChat ')
The value of ' Module_allow_list ' is the name of all the modules you allow to access, and only the modules written here can be accessed.
Finally, a lot of people say to join in the index.php
Define (' Bind_module ', ' home ');
The above is a small series to introduce the thinkphp hidden index.php/home and allow access to other modules to achieve the method, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!