1、下载apache源码包,解压并查找到mod_rewrite.c文件
tar -zxvf httpd-2.2.27.tar.gz
cd httpd-2.2.27
[root@localhost httpd-2.2.27]# find . -name mod_rewrite.c
./modules/mappers/mod_rewrite.c
[root@localhost httpd-2.2.27]# cd ./modules/mappers/
[root@localhost mappers]# /www/wdlinux/apache/bin/apxs -c mod_rewrite.c
/www/wdlinux/httpd-2.2.22/build/libtool --silent --mode=compile gcc -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/www/wdlinux/httpd-2.2.22/include -I/www/wdlinux/httpd-2.2.22/include -I/www/wdlinux/httpd-2.2.22/include -c -o mod_rewrite.lo mod_rewrite.c && touch mod_rewrite.slo
/www/wdlinux/httpd-2.2.22/build/libtool --silent --mode=link gcc -o mod_rewrite.la -rpath /www/wdlinux/httpd-2.2.22/modules -module -avoid-version mod_rewrite.lo
[root@localhost mappers]# /www/wdlinux/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
[root@localhost mappers]# ls /www/wdlinux/httpd-2.2.22/modules/
[root@localhost mappers]# ls /www/wdlinux/apache/modules/
httpd.exp libphp5.so mod_rewrite.so mod_rpaf-2.0.so
可以看到modules文件夹下出现了mod_rewrite.so文件
但后来在启动重启mysql数据库时,发现wdcp已经内建了mod_rewrite模块,不需要单独编译