1) install apache for the first time and add the -- enable-rewrite option during compilation.
For example:/configure -- prefix =/usr/local/apachel -- enable-so -- enable-mod-shared = all -- enable-rewrite -- enable-cache
2) added the mod_rewrite module.
# Find.-name mod_rewrite.c // find the mod_rewrite.c file in the apache source code installation directory
# Cd PATH/to/mod_rewrite.c // enter the directory containing the mod_rewrite.c File
#/Usr/local/apache/bin/apxs-c mod_rewrite.c // apxs should specify the absolute path, in the bin directory where you are currently using apache
#/Usr/local/apache/bin/apxs-I-a-n mod_rewrite mod_rewrite.la
If there are no errors, compile a mod_rewrite.so file in your apache modules directory.
Edit the httpd. conf file and confirm that the httpd. conf file contains the loading statement mod_rewrite.so, as shown below:
LoadModule rewrite_module modules/mod_rewrite.so
At this time, your apache should have supported rewrite.
Note]
When you run the command apxs-c-I-a mod_rewrite.c above, the httpd. cof
Add a row:
LoadModule
Mod_rewrite_module modules/mod_rewrite.so
You need to manually modify mod_rewrite_module
Is rewrite_module,
Otherwise, the following error occurs:
Can't locate API module structure 'mod _ rewrite_module 'in file/usr/local/apache2/modules/mod_rewrite.so: Undefined
Symbol "mod_rewrite_module"
Note: After that, restart the apache server.