Home > Article > Backend Development > A brief discussion on URL rewriting in ThinkPHP, a brief discussion on thinkphpurl_PHP tutorial
The result I want is nothing more than to remove index.php from the URL path
The first is to configure .htaccess
Because I deploy on apache , I need to find LoadModule rewrite_module modules/mod_rewrite.so in the httpd.conf configuration file and remove the # in front of it, find AllowOverride None and change it to AllowOverride All.
Now accessing localhost/product is valid, but the path obtained by __APP__ or __URL__ or U contains index.php, which is localhost/index.php. It turns out that there is another step, which needs to be in conf/config. Modify or add 'URL_MODEL'=>2,
in phpAnd because I am trying to deploy conist Enterprise Edition 2.0 based on ThinkPHP, there is such a configuration in config.php 'URL_MODEL' => C ('TOKEN.false_static'), and the value of TOKEN.false_static It is set to 1 during initialization, so. . . The mode is always 1, PATHINFO mode.
Deployed in Sina SAE , it does not support .htaccess and only supports its own configuration file config.yaml, so add the following rewriting format code to config.yaml:
Isn’t it super simple? If you want to learn more about other pseudo-static aspects, please read the following recommended articles.