This article mainly introduced about thinkphp hidden index.php/home and allow access to other modules of the implementation method, has a certain reference value, now share to everyone, the need for friends can refer to
Want to achieve the effect is very 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 opened. htaccess support on the line, the specific configuration to implement Baidu bar, I use the apache2, build a soft connection into
Ln-s/etc/apache2/mods-available/rewrite.load/etc/apache2/mods-enabled/rewrite.load
Restart Service
Then, you don't have to do anything, index.php is hidden.
<ifmodule mod_rewrite.c>rewriteengine onrewritecond%{request_filename}!-drewritecond%{REQUEST_FILENAME}!- Frewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]</ifmodule>
This is the thinkphp default. htaccess file content, you can see that index.php can be omitted
Then is the home of the hidden, if we directly in the. htaccess file to write home, then, the other modules we can not access, only use the mechanism provided by thinkphp
There is a lot of talk here, but I find that most of them speak frankly, and none of them are complete.
That's what I'm doing.
Adding a configuration to the common/conf/config.php
' Default_module ' = ' home ', ' module_allow_list ' = = Array (' Home ', ' Wechat ')
Where the ' module_allow_list ' value is the name of all the modules that you allow access to, only the modules that are written in this area can be accessed.
Finally, a lot of people say that adding in the index.php
Define (' Bind_module ', ' Home ');