Home > Backend Development > PHP Tutorial > Modify the apache configuration file to remove index.php_PHP tutorial in thinkphp url

Modify the apache configuration file to remove index.php_PHP tutorial in thinkphp url

WBOY
Release: 2016-07-13 10:40:48
Original
917 people have browsed it

For example, your original path is http://localhost/test/index.php/index/add
Then the current address is http://localhost/test/index/add
How to remove index. What about php?

1. The mod_rewrite.so module is loaded in the httpd.conf configuration file //Configure in APACHE

Copy the code The code is as follows:

#LoadModule rewrite_module modules/mod_rewrite.soRemove the warning number in front

2. AllowOverride None. Change None to All //Configure in APACHE (note that AllowOverride in other places is also set to ALL)

Copy code The code is as follows:


AllowOverride none Change to AllowOverride ALL
Options None
Order allow,deny
Allow from all

3. Make sure URL_MODEL is set to 2 and write

in the project configuration file.

Copy code The code is as follows:

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

4. The .htaccess file must be placed in the same directory
In this file, add:

Copy the code The code is as follows:


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


Additional note: Files starting with a dot cannot be created under Windows. You can create a file first
Then operate rename xxxx.xxxx .htaccess in DOS

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/710602.htmlTechArticleFor example, your original path is http://localhost/test/index.php/index/add then the current The address is http://localhost/test/index/add. How to remove index.php? 1. Add...
to the httpd.conf configuration file
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template