ManyCodes.com – codes & scripts Get free programming codes and tutorials!

6Aug/092

How to enable mod_rewrite in apache 2.2 in Debian and Ubuntu

I am going to describe how to enable mod_rewrite in apache2.2 - specaily for debian.

In default installion of apache2.2 on debian never enable mod_rewrite default. So you may need to enable.

debian user please use “su” before start this process
ubuntu user please use “sudo su” before start this process

  1. First install the apache2.2 with this command :
apt-get install apache2

(it will install apache 2.2)

now use locate to find if the mod_rewrite.so is availble on your server

updatedb
 locate mod_rewrite.so

it will found in “/usr/lib/apache2/modules”

new apache follow some folders to enable and desuable mods.
so now do this:

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

Then edit /etc/apache2/sites-available/000-default

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

OK, you done :D

Don’t forget to comment, if it works or not.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Webnews
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Ask
  • Facebook
  • Technorati
  • YahooBuzz
  • Johan T

    It worked! Thanks

  • AFAICT you’ve ceovred all the bases with this answer!