thinkphp - Problem with the default home page of the TP framework site
某草草
某草草 2017-05-16 16:57:24
0
3
635

I am using version 3.2. For example, my domain name is http://www.xxxxx.com/ The page of this domain name is the zhuye method under the zhuye controller. Now when I visit this page, I have Index.php and the module have been removed. Now you can access it like this http://www.xxxxx.com/zhuye/zhuyeThis page is impossible because this zhuye/zhuye page is the homepage of the site. Let the user enter the name of the controller and operation method to access it. So I want the user to directly access zhuye/zhuye when they enter http://www.xxxxx.com/ When accessing this page, the domain name should not show the controller and operation method names. However, if the controller and operation method names are removed and the domain name is used to access directly, it will be the access entry file. How should this homepage be set up so that the controller and operation method names do not appear? ? Should I use redirection? If so, how should this rule be written?

某草草
某草草

reply all(3)
伊谢尔伦

The configuration file sets the default controller and methods, please read more about the configuration file.

Ty80

This question involves two points:

  1. URL rewriting has nothing to do with the TP framework, it is mainly about WEB server configuration,
    Apache:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php/ [QSA,PT,L]
</IfModule>

Nginx:

location / { // …..省略部分代码
   if (!-e $request_filename) {
   rewrite  ^(.*)$  /index.php?s=  last;
   break;
    }
 }
  1. Modify the tp framework URL mode configuration: URL_MODEL, your requirement should be pathinfomode

  2. If you have a single module, you can bind the entry in the index.php file

给我你的怀抱

Some methods have been provided above!
You can also add tp routing to route the homepage to zhuye/zhuye

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template