ubuntu apache2 启用mod_rewrite模块的方法

使用a2enmod rewrite,然后重启apache在ubuntu下无效。

察看apache启用了什么模块的命令:apache2ctl -M

ubuntu apache2 启用mod_rewrite模块的流程如下:

cd /etc/apache2/mods-enabled
touch rewrite.load
gedit rewrite.load (you may use any editor to edit this file)

now paste this following line

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

end of old style

Then edit /etc/apache2/sites-available/default or /etc/apache2/sites-available/000-default (check which one available on your system)

Find the following

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

and change it to

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all

and finally restart Apache

/etc/init.d/apache2 restart
or
service apache2 restart

发表评论

电子邮件地址不会被公开。 必填项已用*标注