thinkphp How to configure hidden portal files

Source: Internet
Author: User

Apache server is not enabled by default rewrite module, so we visit the thinkphp site when the URL path is generally like this:

Http://127.0.0.1/index.php/index/article/list.html

Here index.php is our site entry file, and in order to achieve better SEO optimization, we need to index.php the entry file, the final implementation of the following access path:

Http://127.0.0.1/index/article/list.html

First step: First, you need to open the Apache server configuration file httpd.conf, load the mod_rewrite.so module.

Specifically, to the author of the Wamp integrated development environment for example, under the directory "C:\wamp\bin\apache\apache2.4.9\conf" to find the Apache configuration file httpd.conf, find mod_rewrite.

#LoadModule Rewrite_module modules/mod_rewrite.so

Then remove the # from the front of the line.

Continue to find all allowoverride None and modify all of them to allowoverride all.

The final reboot of the Apache server will allow the configuration to take effect.

Second Step: Save the following as a. htaccess file, and put it in the directory of the portal file sibling.

<ifmodule mod_rewrite.c>options +followsymlinks-multiviewsrewriteengine onRewriteCond%{REQUEST_FILENAME}!- Drewritecond%{request_filename}!-frewriterule ^ (. *) $ index.php?/$1 [qsa,pt,l]</ifmodule>

The. htaccess file can be generated with a notepad that comes with Windows. The method is "Save as File type: All Files", and then fill in the file name. htaccess, as shown here:

You can successfully hide the portal file by completing the two-step setup.

thinkphp How to configure hidden portal files

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.