We know that there is a. htaccess file in the thinkphp case, which is configured with URL rewrite rules, such as RewriteEngineonRewriteCond % {REQUEST_FILENAME }! -DRewr...
We know that there is a. htaccess file in the thinkphp case, which is configured with some URL rewrite rules, such:
- RewriteEngine on
- RewriteCond % {REQUEST_FILENAME }! -D
- RewriteCond % {REQUEST_FILENAME }! -F
- RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
It is used to set URL rewriting to hide index. php contained in the URL. generally, URLs that are too long or dynamic are not conducive to SEO, so the purpose of hiding is to achieve better SEO effect.
Understand the role of the. htaccess file, and then let it work. to make the. htaccess file take effect, the server usually needs to enable the URL_REWRITE module for support.
The configuration process of Apache is as follows:
1. the mod_rewrite.so module is loaded in the httpd. conf configuration file.
Search for LoadModule rewrite_module modules/mod_rewrite.so in the httpd. conf configuration file (this is what Apache2 is) and remove the previous #
2. change AllowOverride None to All
In the httpd. conf configuration file, locate "AllowOverride None" and change "None" to "All. It is worth noting that "AllowOverride None" can be found in the file, but there is only one thing to change ,:
To learn how to install an integrated server environment such as wampserver or an independent installation (download and install Apache, php, and mysql respectively), follow these steps.
If your website is placed on a virtual server, you do not have the administrator permission on the server where the website content is located, or your website content is hosted on the ISP server, you cannot rewrite the main configuration file httpd. conf, what should I do? Generally, the main configuration file is httpd. conf has enabled the mod_rewrite.so module. all you need to do is find httpd in your website space. conf file (not the main configuration file, the configuration in it only works for your website), and write "AllowOverride All" to it.