一、手动修改配置文件法
根据安装过程的不同,配置文件存放的位置可能会有所不同。
在ubuntu中,如果采用apt或tasksel进行apache的安装,则apache的配置文件会被分开放置到多个文件中。在ubuntu12.04中,apache的配置文件会分散放置在目录apache2下。在该目录下,mods-available中保存的是可用模块,mods-enabled中保存的是启用的模块对应于可用模块文件的软连接。如果想启用某个模块,只需在mods-enabled下创建模块文件的软连接即可,同样,删除软连接就是禁用模块。
开启方法:
samleeo@localhost:~$sudo cd /etc/apache2/mods-enabled/
samleeo@localhost:/etc/apache2/mods-enabled/$sudo ln -s ../mods-available/rewrite.load .
samleeo@localhost:/etc/apache2/mods-enabled/$sudo service apache2 restart
二、命令法
ubuntu中还可以通过a2enmod开启rewrite模块,不过,开启的原理和上面是一样的(创建软连接):
samleeo@localhost:~$sudo a2enmod rewrite