Modifying the Apache configuration file to remove index.php_php instances from thinkphp URLs

Source: Internet
Author: User

For example, your original path is http://localhost/test/index.php/index/add.
So now the address is Http://localhost/test/index/add
How do you get rid of index.php?

1, httpd.conf configuration file loaded with the Mod_rewrite.so module//in Apache to configure

Copy Code code as follows:

#LoadModule rewrite_module modules/mod_rewrite.so To remove the siren from the front.

2. allowoverride None speak none to all//in Apache (note that all other allowoverride are set to all)

Copy Code code as follows:

<directory "D:/server/apache/cgi-bin" >
allowoverride None Change allowoverride all
Options None
Order Allow,deny
Allow from all
</Directory>

3, to ensure that the Url_model set to 2, in the project's configuration file to write

Copy Code code as follows:

Return Array (
' Url_model ' => ' 2 ',
);

4. htaccess files must be placed in the directory
This file adds:

Copy Code code as follows:

<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]
</IfModule>

Add: You can't create a file that starts with a dot under windows, you can create a file first
Then in DOS in the Operation rename Xxxx.xxxx. htaccess

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.