Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the apache configuration file to remove index.php from thinkphp url

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report