1. Put the Apache server in the debugging status, so that after changing httpd. conf, it will take effect immediately as long as it is saved.
2. Open the rewrite module.
3. Virtual Path Test
4. Add the default path
5. Conclusion: This article does not study rewriting of. htaccess.
Detailed description:
1. Add this section to around 152 rows (in fact, add it to any ifmoudle module:
# no need to restart server in devoping periodMaxRequestsPerChild 1
2. uncomment this line:
#LoadModule rewrite_module modules/mod_rewrite.so
3.Virtual HostsConfigure nodes to configure virtual hosts,
There are many methods. For example, multiple IP addresses correspond to multiple directories. I used to use this method all the time. Today, this is a failure. This method will be discussed later, today, let's talk about one IP address and multiple domain names, corresponding to multiple directories.
For example, if I access a project under the WWW/pie path in my directory from www.dxpie.com, then I set it like this,
First, since it is an IP address, specify this IP address first,
NameVirtualHost *:80
Then, configure document root
<VirtualHost *:80>ServerName www.dxpie.comDocumentRoot "${path}/www/pie"</VirtualHost>
Finally, modify the hosts file and direct www.dxpie.com to 127.0.0.1.
Now let's test that www.dxpie.com successfully points to my www/pie directory,
But the problem came out. I used localhost and actually directly transferred it to the pie directory. So after step 2, add a few more virtual paths to test it.
4. Add the following code under namevirtualhost *: 80:
<VirtualHost *:80>ServerName localhostDocumentRoot "${path}/www"</VirtualHost>
Save and test. Does localhost point to the WWW directory? More than that, all access to port 80 on your local machine will be blocked by this node if it is not matched by other virtual hosts, and access www directly. This is exactly what I want, if you don't think so, change the path.
5. Do more and make some simple settings for the directory you direct:
<Directory "${path}/www/pie">Options Indexes FollowSymLinksAllowOverride AllOrder deny,allowAllow from all</Directory>
This is copied from the configuration file above. What does it mean? Google can roughly enable rewriting to ensure access.