Set thinkphp (3.2.1) Default entry file, and URL rewrite mode

Source: Internet
Author: User

Prerequisite one: In the Php+apache configuration environment

First, set the thinkphp project default entry file:

Locate the Apache installation directory apache24\conf\ under configuration file: Httpd.conf file. Find DirectoryIndex after opening

Change the default index.html file to a index.php file (any portal file you want to set)

After restarting Apache, the settings take effect.

Note: When moving an item to another computer or server, because the default portal file is configured in Apache, it will not be moved to another computer as the project, so be aware that other computers and development computers should be consistent, otherwise they will not run the project program properly

Second, set the URL rewrite mode

Locate the Apache installation directory apache24\conf\ under configuration file: Httpd.conf file.

1. Find mod_rewrite.so Remove Current line comment, add load write mode

2. Change the default setting of none after all allowoverride to: all

1)

2)

3)

And in the thinkphp file Config file, configure the rewrite mode to 2:

Rewriter Rewrite mode
' Url_model ' =>2,

After restarting Apache, the settings take effect.

Note: Because URL rewrite mode is configured in Apache, it does not move with the project. So note that other computer configurations should be consistent, otherwise the project program will not run properly

Set thinkphp (3.2.1) Default entry file, and URL rewrite mode

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.