how to enable mod_rewrite in apache2.2 (debian/ubuntu)
Here 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 .
First install the apache2.2 with this command :
debian user please use “su” before start this process
ubuntu user please use “sudo su” before start this process
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
don’t forget to comment, if it works or not.
thanks.
Related posts:
- Website optimization 02: enable deflate /output compression (debian/ubuntu) On the first post of this series we learned how...
- how to move your php development environment to linux (Debian/Ubuntu) Nowadays, lots of php developers are thinking to move their...
- Website Optimization 01: disable ETag in apache (debian/ubuntu) From last few months i am working to optimize our...
- install imagemagick support to your debian/ubuntu server imagemagick is one of the best library to work with...
- Installing ttf fonts on Debian or Ubuntu Linux Here is the simple step to install ttf font on...
Related posts brought to you by Yet Another Related Posts Plugin.





জুন 16th, 2007 at 12:08 am
Whoa!!
Excellent work Lavlu, much appreciated. This was one of my major problem even few days ago. I just think why didnt you write this article that time.
Very good work. Keep it on.
জুন 24th, 2007 at 3:03 pm
Or more simpler, just do :
sudo a2enmod rewrite && sudo invoke-rc.d apache2 restart
জুন 24th, 2007 at 3:42 pm
thanks ebzao. it works
অগাষ্ট 4th, 2007 at 11:43 pm
[...] how to enable mod_rewrite in apache2.2 (debian/ubuntu) [...]
অগাষ্ট 19th, 2007 at 4:48 am
Worked like a charm! Thanks for posting this.
অগাষ্ট 29th, 2007 at 9:11 pm
[...] to this explanation of how to fix [...]
সেপ্টেম্বর 17th, 2007 at 10:37 pm
thank bro…it works…
অক্টোবর 25th, 2007 at 9:03 am
Dear Lavluda
I want pdf of your how to move your php development environment to linux (Debian/Ubuntu) .
জানুয়ারি 8th, 2008 at 12:38 am
Thanks!! Simple and elegant solution!
জানুয়ারি 8th, 2008 at 2:41 am
Excellent!!, finally find perfect and simple solution..
Thanks!
Thanks a lot.
ফেব্রুয়ারি 3rd, 2008 at 10:11 am
hey, thanks a lot man. Great job, couldn’t have been put simpler
এপ্রিল 24th, 2008 at 6:41 pm
Thank you very much it works
One comment. I’ve found you through google and google sais to me that you are dangerous here is the link look yourself http://www.google.gr/interstitial?url=http://www.lavluda.com/2007/07/15/how-to-enable-mod_rewrite-in-apache22-debian/
I don’t think that your blog is dangerous. You can complain about that.
এপ্রিল 28th, 2008 at 10:45 pm
thank you very much
মে 5th, 2008 at 4:28 pm
Works like a charm! Enabled it on Ubuntu 8.04 Server. Thanks!!
মে 17th, 2008 at 4:32 am
Thnx Thnx

it realy worx
মে 18th, 2008 at 7:36 pm
/etc/apache2/sites-avalible/000-default is /etc/apache2/sites-available/000-default or /etc/apache2/sites-available/default
মে 19th, 2008 at 1:05 pm
thanks saltedlight, it was typing mistake
fixed
মে 27th, 2008 at 7:48 pm
Works!!!
জুন 3rd, 2008 at 8:30 pm
Thank you sir. Very succinct! Much appreciated.
জুন 3rd, 2008 at 11:33 pm
Thank you soooo much !!!!
Worked first time, brilliant!!!!!!
জুন 10th, 2008 at 2:27 pm
Thank you much! Perfect!
জুন 24th, 2008 at 11:46 pm
Excellent work, a person knowing very little about installing apache in linux could do it without any difficulty. and yes it worked..!!
Thanks
জুন 29th, 2008 at 2:17 am
Jeez.. You have no idea how glad I am i found this. I have been struggling with linux for a few days now. No idea why everything has to be this hard.
জুন 3rd, 2008 at 7:15 pm
Are you serious?
Never heard about a2enmod command?
#a2enmod rewrite
#/etc/init.d/apache2 restart
জুন 3rd, 2008 at 9:08 pm
a2enmod will only work for apache2 default modules. what about if you compiled apache2 ?
জুন 17th, 2008 at 2:40 pm
Thanku very much yaar, i was searchin for this only thing for last 2 days…..Thanx a lot.
জুন 17th, 2008 at 9:59 pm
how to activate mod rewrite in CentOS ??
plzz rply faast i m in danger
জুন 20th, 2008 at 8:22 pm
Very important to say that before you apply rewrite rules you need to say in the site configuration RewriteEngine On
so the rewrite configuration example looks like this:
RewriteEngine On
# allow only for https!
RewriteCond %{SERVER_PORT} 80
RewriteRule ^/svn(.*) https://%{SERVER_NAME}/svn$1 [R,L]
জুন 21st, 2008 at 7:19 pm
nice, it helps me a lot … but …
when I try to change AllowOverride None to All, I get the external error and I cannot access my page…Any ideas I’d appreciate so much
জুন 21st, 2008 at 7:21 pm
sorry…500 Internal error
জুন 22nd, 2008 at 1:29 pm
I solved this by setting virtual host
nice
জুন 27th, 2008 at 8:41 pm
Excelent! it really works.
I tried because webmedia explorer requires it: http://www.webmediaexplorer.com
অগাষ্ট 12th, 2008 at 4:07 am
Very well done! it worked for me, thanks.
অগাষ্ট 26th, 2008 at 4:29 pm
tanks a lot !!
অগাষ্ট 27th, 2008 at 6:21 pm
[...] mod rewrite how to enable mod_rewrite in apache2.2 (debian/ubuntu) [...]
অগাষ্ট 31st, 2008 at 4:29 am
This could be achieved more easily by symlinking from /etc/apache2/mods-available/rewrite.load (this will also work with any of the other modules that have a file in mods-available).

সেপ্টেম্বর 22nd, 2008 at 7:47 pm
this was the only tutorial that made my htaccess files work. thank you very much. good order and good explanation and descriptions.
thanks…
অক্টোবর 19th, 2008 at 6:35 pm
I saw many tutorial but yours works perfectly
Good work Lavlu!
অক্টোবর 27th, 2008 at 1:06 pm
[...] This is my source: http://www.lavluda.com/2007/07/15/how-to-enable-mod_rewrite-in-apache22-debian/ [...]
অক্টোবর 29th, 2008 at 1:45 am
Thanks a lot i’ve forgot about the AllowOverride All that was my problem
নভেম্বর 10th, 2008 at 5:19 pm
Most tutorials in regards of ‘mod_rewrite’ out there today, even at Apache site are often referring to older versions, so from that perspective it’s nice with a fresh tutorial.
However if you are reading this then you should be aware of the following:
The ‘Enabled’ directory is to contain Links into ‘Available’ directory. Doing anything else is stepping away from the intended server structure. So copy the ‘rewrite.load’ as a link from the ‘Available’ directory, into the ‘Enabled’ directory. No need to edit anything!
The ‘000-default’ is your Apache2 server default file changes here are very global. The edit above actually opens up for the use of ex:’.htaccess’ files in the whole site.
Normally you leave this file alone and make the appropriate changes at a lower level. Like in the ‘apache2.conf’ which is the normal place for server wide alterations.
Just a tip…
নভেম্বর 12th, 2008 at 8:28 pm
Thanks!