ThinkPHP is a free, open-source, fast, and simple object-oriented lightweight PHP development framework. It complies with the Apache2 open-source Protocol and is born for agile WEB application development and simplified enterprise application development. During use, we often need to remove index. php from the URL path, because it is really awkward. To solve this problem, I want to remove index. php from the URL path.
First, configure. htaccess
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
Because I am deployed on apache, I need to find LoadModule rewrite_module modules/mod_rewrite.so In the httpd. conf configuration file to remove the previous # And change AllowOverride None to AllowOverride All.
Currently, access to localhost/product is valid, but/index. php or/index. the paths obtained by php, Article, and U contain indexes. php, that is, localhost/index. php, there is another step, which needs to be done in conf/config. modify or add 'url _ model' => 2,
Because I tried to deploy ThinkPHP-based conist enterprise 2.0. php has such a configuration 'url _ model' => C ('token. false_static '), and TOKEN. the false_static value is set to 1 during initialization, so... The pattern is still 1, PATHINFO pattern.
Deployment in Sina SAE does not support. htaccess, but only supports its own configuration file config. yaml. Therefore, add the following overwrite format code in config. yaml:
handle:- rewrite: if(!is_dir() && !is_file() && path~"^(.*)$") goto "index.php/$1"