Remove the index.php in ThinkPHP

For example, your original path is http://localhost/test/index.php/index/add, and you want to it like this http://localhost/test/index/add.

Configure Apache

Make sure that httpd.conf configuration file loaded module, uncommented:

# LoadModule rewrite_module modules/

Modify AllowOverride None to AllowOverride All

Configure ThinkPHP

Make sure URL_MODEL set to 2, in the project's configuration file:

return Array(
   'URL_MODEL' => '2',

Modify .htaccess

Add to .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
0.00 avg. rating (0% score) - 0 votes