Home  >  Q&A  >  body text

thinkphp - Problem with the default home page of the TP framework site

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?

某草草某草草2713 days ago587

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 16:59:24

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

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 16:59:24

    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

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-16 16:59:24

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

    reply
    0
  • Cancelreply