How to modify the apache configuration file to remove index.php from thinkphp url
This article mainly explains "how to modify apache configuration file to remove index.php in thinkphp url", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly in-depth, together to study and learn "how to modify apache configuration file to remove index.php in thinkphp url"!
For example, your original path is http://localhost/test/index.php/index/add
So the current address is http://localhost/test/index/add
How to remove index.php?
1. The mod_rewrite.so module is loaded in the httpd.conf configuration file.//Configure it in APACHE.
The copy code is as follows:
#LoadModule rewrite_module modules/mod_rewrite.so Remove the warning sign in front
2. AllowOverride None is changed to All //Configure it in APACHE (note that AllowOverride in other places is also set to ALL)
The copy code is as follows:
AllowOverride none to AllowOverride ALL
Options None
Order allow,deny
Allow from all
3. Make sure URL_MODEL is set to 2 and write it in the project configuration file.
The copy code is as follows:
return Array(
'URL_MODEL' => '2',
);
The.htaccess file must be placed under the following directory
Add to this document:
The copy code is as follows:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !- d
RewriteCond %{REQUEST_FILENAME} !- f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
Supplement: under windows can not create a file starting with a dot, you can first create a file at random
Then in DOS in operation rename xxxx.xxxx .htaccess
Thank you for reading, the above is "how to modify the apache configuration file to remove the index.php in the thinkphp url" content, after learning this article, I believe we have a deeper understanding of how to modify the apache configuration file to remove the index.php in the thinkphp url, and the specific use needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!