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)
on current debian system you can enable mod_rewrite with simple command
a2enmod rewrite
old style, you can skip this portion
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 disable 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
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
OK, you done 😀
don’t forget to comment, if it works or not.
thanks.
if you like my post, please tweet it, so other also can see this post.
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.
Or more simpler, just do :
sudo a2enmod rewrite && sudo invoke-rc.d apache2 restart
thanks ebzao. it works 🙂
Worked like a charm! Thanks for posting this. 🙂
thank bro…it works…
Dear Lavluda
I want pdf of your how to move your php development environment to linux (Debian/Ubuntu) .
Thanks!! Simple and elegant solution!
Excellent!!, finally find perfect and simple solution..
Thanks!
Thanks a lot.
hey, thanks a lot man. Great job, couldn’t have been put simpler
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.
thank you very much 🙂
Works like a charm! Enabled it on Ubuntu 8.04 Server. Thanks!!
Thnx Thnx 😀
it realy worx 😀
/etc/apache2/sites-avalible/000-default is /etc/apache2/sites-available/000-default or /etc/apache2/sites-available/default
thanks saltedlight, it was typing mistake 🙁
fixed
Works!!!
Thank you sir. Very succinct! Much appreciated.
Thank you soooo much !!!!
Worked first time, brilliant!!!!!!
Thank you much! Perfect!
Excellent work, a person knowing very little about installing apache in linux could do it without any difficulty. and yes it worked..!!
Thanks
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.
Are you serious?
Never heard about a2enmod command?
#a2enmod rewrite
#/etc/init.d/apache2 restart
a2enmod will only work for apache2 default modules. what about if you compiled apache2 ?
Thanku very much yaar, i was searchin for this only thing for last 2 days…..Thanx a lot.
how to activate mod rewrite in CentOS ??
plzz rply faast i m in danger
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]
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
sorry…500 Internal error 🙁
I solved this by setting virtual host 🙂 nice
Excelent! it really works.
I tried because webmedia explorer requires it: http://www.webmediaexplorer.com
Very well done! it worked for me, thanks.
tanks a lot !! 😉
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).
🙂
this was the only tutorial that made my htaccess files work. thank you very much. good order and good explanation and descriptions.
thanks…
I saw many tutorial but yours works perfectly 🙂 Good work Lavlu!
Thanks a lot i’ve forgot about the AllowOverride All that was my problem
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…
Thanks!
thanks a lot! 😀
Thanks man, it works like a charm. Thanks to this tutorial i’ve enabled the “Clean URLs” option in Drupal.
THANKS!!! I’d been racking my brains trying to get my .htaccess file working. It was full of Rewrite directives. Then I found your explanation. Worked perfectly.
Thanks, again.
whoaa…its work..thanks…but when i check the mods loaded by apache using apache2ctl -l , mod_rewrite isn’t on the list..but after all it works :p .thanks.
maque, my impression is that to see the loaded modules you should do apache2ctl -M
…and BTW Lavluda, it worked for me as well. But I’d like to know why.
Is there a good book re Apache 2.0 somewhere? The difference between Apache 1.x and 2.x is significant re implementation. It’s much more convoluted; more confusing. So before I make my site public, I’d like to know that I haven’t compromised security in any way.
This is a follow-up to my post yesterday…
I spoke too soon. After the tweak, my other non-Drupal sites were no longer available.
The odd thing is that after I reset everything to the initial Drupal (ie, post-install) settings, clean-urls still worked and my other non-Drupal sites were available once more.
My system is Linux debian 2.6.26-2-amd64 (Lenny). The bottom line is, in my case, the tweak did not work.
I could not enable the clean URL on a test copy of a Drupal site.
With this tuto it works.
Thank you
Thanks a lot
worked like a charm!
as you already know!
Thank You!
Great Job!
Thanks,thanks,thanks!
totally worked and i had my doubts.
many thanks.
YOU SAVE MY LIFE!! Lol!
All of this because of a simple line change!!
it worked file. in addition i also create a symlink in mods-enables to mods-availables/rewrite.load
Thank you for this article. I was happy to finally find an article explaining what to do that actually make sense. Thanks for the help you gave.
@Chris Cotter
i am really fell good when see my works is helping others . thanks for comments.
Thanks, It worked perfectly.
Thanks dude, clean concise exactly what I needed while concentrating on my real issues.
Bil
Excellent. Thank you very much, only one observation: to change the site-enable default site i recommend do this:
(in su user)
# a2dissite default
# gedit /etc/apache2/sites-avaibles/default
[Make the changes that you suggest]
# a2ensite default
# /etc/init.d/apache2 reload
This because sites-enable is like a “instance” of site-avaibles in apache2.
Regards
Carlos
Thanks very much. Worked for me with no sweat at all.
It worked for me. Thanks for the article.
You only need to link the given files from mods-available to mods-enabled
#ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
apache2ctl restart
Isn’t that easier? (for debian lenny)
Debian has a built in function for enabling (linking) mods and sites
# a2enmod rewrite
will enable mod_rewrite
# a2ensite default
will enable your default site
restart or reload apache2 to see changes
# apache2ctl restart
Men, you just save my life!!! thankyou very much!!!!
Oh guy! Thanks a lot!
I’m trying do this ft apache rewrite_mod works since two weeks ago…
Now it works
xxx
This post help me very much. Thanks a lot.
I use cakephp and this is an important step in the config phase to run cake successfully.
Thanks again and best regards,
Doan Huynh
Thank you very much! Very useful
Awesome man, thanks!
Many Thanks Sir. Your steps worked for me. Finally i found the article explaning what exactly needs to be done.
Dude, fantastic right up brother!
I’m running turnkey LAMP vm and using webmin to enable mod_rewrite but it still wasn’t working!!! ugh…
Followed you how to here, got in and did the dirty work the old fashioned way and BOOM! rewrites are working like a champ now!
Thx a million!
Most appreciated… you make the web keep spinnin!
nice stuff , really usefull
Hey Ibrahim,
Thanks for this. Rewrites are working like a charm now 😀
Thank you…finally this helped me install elgg.
Thanks! Have been searching bigtime this simply worked out well! Keep up the good work.
Thanks a million, this is one of those golden posts that addresses the problem perfectly – worked first time, nicely explained – fantastic!
Was causing me a headache, was getting close to the root of the problem but you sorted it instantly – great tip. Thanks again for posting it!
the google search “debian enable rewrite” lists this blog as number one, congrats. And the information works, although the information from mike [http://www.lavluda.com/2007/07/15/how-to-enable-mod_rewrite-in-apache22-debian/#comment-2598] is a cleaner way of keeping a debian config intact…
thanks, its a very old post. i will rewrite it when i get some time.
thx a lot. awesome… very usefull
Very nice! It did the trick for me!
Thank you 🙂
Wow! [Tweeted this article!]
I usually go with XAMPP but for a change I tried installing from synaptic and got some serious headache with httpd.conf file and to change the www directory. Even after figuring out how to enable modules myself (with links) I forgot to change the “AllowOverride all”. I was just going to remove all packages and reinstall XAMPP.
Thank You A LOT (Jazakallahu Haira).
Works perfectly! Thanks.
Oh THANK YOU so much for writing this I’ve spent 4 days searching the internet for this trying everything and finally I found this and it works perfectly. I’m so relieved right now because its finally fixed 🙂
Great article; however, Apache includes a function that will install the rewrite mod for you.
sudo a2enmod rewrite
Then finish by modifying the 000-default file as described above and restart the server.
Cheers!
Hmm… cp /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
Works fine too.
There is no 000-default file in Ubuntu 9.10.
@Shaun,
it changed to default
Hello,
I’d only like to thank You for that post, works great.
Greetings from Poland :).
Thanks a lot from Ukraine!
Just what I need.
This is exactly what I was looking for. Thanks for the tip! 🙂
Works totally!
I couldnt The debian gave me this error can anyone help me?
ERROR: Module rewrite not properly enabled: /etc/apache2/mods-enabled/rewrite.load is a real file, not touching it
Works for me. Thank you kind sir 😉
Great job simplifying the process. I’m fairly new to *nix and following your directions was a piece of cake. I had to enable this thing to allow permalink redirect on my WordPress blog website.
Solved it you superstar 🙂
I had a live site down with no working permalinks, permalinks hardcoded into the copy all over the place and no way to fix. As you say Apache2.2 doesn’t have mod_rewrite on by default, enabling fixed all the issues. Thanks again 🙂
Thanks a bunch buddy …. you saved my hours
I awe you a beer !!!
cheers
VERY VERY GOOD !!!!
All acts
Thanks, it work!!
Thank U very much.. that’s work..
Regard
Muhammad Amin (Indonesia)
worked like a charm! thanks alot man, great work!!
It is great to get some advice that actually works. But this is really the wrong advice. It is correct that the rewrite module should be activated, and this solution will work. However, rewrite.load already exists in /etc/apache2/mods-available/. A link to that file should be created in /etc/apache2/mods-enabled/. It’s not that the suggestion won’t work. It is just contrary to the intended configuration of Apache2 on Debian/Ubunto (Linux ?). As a Windows developer it is a tough task switching to Linux. I hope to get advice that matches the architecture so I better understand what is going on. It was better for me to learn that available mods are specified in mods-available and are activated by linking to the proper conf file in mods-enabled rather than start generating new files in mods-enabled.
@Glenn,
you missed my point. i know it can be done with just one command “a2enmod rewrite” . but here i showed manual way, if you have a custom .so (module) to load, you must have to follow my way.
this article is too old, will rewrite it as it’s getting huge hit every single day.
Perfect it worked!!!
Thanks, worked fine. Just the 000-default is named only “default” on my system.
Worked!Thanks
Gracias.
Por fin pude activar el clean-urls de Drupal.
ahora tengo el gusto de que mi artÃculo le ayudó:)
Thank you! Perfect 😀
use only this command:
# a2enmod rewrite
I cannot find file /etc/apache2/sites-available/000-default on ubuntu 9.04
@Sitthykun
Perhaps
/etc/apache2/sites-available/default
I just want to say I love you. I don’t care if you’re a man or a woman, but I’ve been wrestling with a WordPress install for twelve hours now, and this fixed it entirely, and I love you.
I am running Ubuntu 10.04, and from the command line I tried running “a2enmod rewrite”, but that was not enough to enable the feature. However I did “sudo vi /etc/apache2/sites-available/default” (note the difference in file name), changed “Order allow,deny” to “Order allow,all”, saved my changes, and from the command line executed: “sudo service apache2 restart”.
After apache2 came back up, the rewrite feature was enabled. THANK YOU!
I had already installed Drupal without this feature. If anyone else is in this boat, as Drupal administrator, go to “administer >> site configuration >> clean urls”. You can run a test there to determine if the rewrite feature is enabled (in my case it seemed to auto-test it). It was. (Yay!) You can then enable Clean URLs and save your configuration changes.
Thanks a lot! That’s the solution I needed.
Thanks a lot!
It work great!!!!
Hi Lavluda!
You are the grand-ala-pubah of apache2!
This worked perfectly for me! the “AllowOverride all” was all I was missing! Your rock!
Outstanding…
on debian5, 000-default is not loacated in sites-avaiable but in sites-enabled directory.
so this is wrong location: /etc/apache2/sites-available/000-default
this is correct location /etc/apache2/sites-enabled/000-default
After about 2 days of searching and finding no solution i found your post and it did the trick, thanks a million, good luck 😀
“a2enmod rewrite” returns the following:
ERROR: Module rewrite not properly enabled: /etc/apache2/mods-enabled/rewrite.load is a real file, not touching it
Any clues what could be wrong? 🙂
That saved the day, thank you!
Actually, all you need to do is (in Ubuntu 10.04 anyway) do:
mv /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled
/etc/apache2/mods-available contains a lot of the available mods for apagace (as the folder sname suggests. All you have to do is move it into the enabled folder then restart apache:
service apache2 restart
Done.
Dan
@Dan Horrigan, Or even better:
ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
Thanks for this! Worked like a charm :))
OMG, you really saved my day.
Not before reading your post after a desperate “apache2 mod_rewrite debian” in google, did I think of verifying that my mod_rewrite was indeed working.
Damn, 10 years doing that and still stumbling on the same old mistakes.
Thanks a million 🙂
Worked perfectly for me
for me it was
/etc/apache2/sites-available/default
instead of
Then edit /etc/apache2/sites-available/000-default
Ibrahim, Thanks a ton.
Works fine.
Love you!
the config file was
/etc/apache2/sites-available/default
Thanks a lot guys! I can solve my problem. Shukriya!!!
Thank You
it works. Thanks also to all of the helpful comments.
Thanks
Confirmed. Works fine for me on debian with apache 2.2.9-10+lenny9 from the stable version
Distributor ID: Debian
Description: Debian GNU/Linux 5.0.7 (lenny)
Release: 5.0.7
Codename: lenny
After much effort and frustration, your post helped me get to the root of my problem and solve it!
I just want to give you a BIG thank you and appreciate your wonderful post.
Thanks.
Hey Mate,
It worked just perfectly fine thanks you very much for help.
Awesome, works every time! Thanks buddy…
Huge thanks….struggled for hours in search of answers…..this article fixed it in 5 minutes. Thanks!
That’s great, thank you!
It worked perfectly in Apache 2.2.16 on Ubuntu 10.10, except that, as somebody mentioned, there was default file, not 000-default.
Worked good for me thanks!
Like somebody pointed out, the file to edit is /etc/apache2/sites-available/default
Thanks a lot…… works like a charm
It works!
It works man, it works!! I had used a2enmod rewrite, and that worked, but I still needed to change 000-default in Ubuntu 10.04, and my scripts worked like a charm. Thank you
This worked except for one minor detail. We use Ubuntu 10.10 and instead of ‘000-default’, we have ‘default’. Great tip in all! 🙂
Thanks :o)
This worked as documented with a few minor issues:
I am running Ubuntu 10.04.2, and like others, I found a file called /etc/apache2/sites-available/default
instead of /etc/apache2/sites-available/000-default
My file /etc/apache2/sites-available/default contains more than one section with:
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
The one that needed to be changed was the one prefaced by:
Other than that, the instructions worked splendidly!
Many thanks for making this info available. 🙂
Correction to the above,
The entry in /etc/apache2/sites-available/default that needed to be changed was the one prefaced by:
<Directory /var/www
Thank you. I was trying everything and this worked well.
Thanks a lot for this wonderful article.
thx alot.. it’s really help
following error was produced:
* Restarting web server apache2 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[fail]
please make sure that you have root privilege to start/restart the apache.
Excellent post, great comments.
I did this part differently – I edit the site Apache config file (as my sites are located in a different folder / partition to the main www folder – plus my “user” is in a SSH chroot):
# Then edit /etc/apache2/sites-available/site-example.com
# Find the following
Options FollowSymLinks
AllowOverride none
Order allow,deny
allow from all
# and change it to
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
Worked great for me. Thanks.
To enable mod_rewrite in Ubuntu, you just need to write this command in terminal
sudo a2enmod rewrite
Hi, from Mexico thanks a lot,
YES…it worked very well.
Thank you very much!!! I think it solved my problem.
Hey… Thank you buddy……..
you Roack………………..
Thank’s! 🙂
Awesome :-). Thank you very much!
Works fine! Thank’s!
Work’s fine! Thank’s!
Hello everybody!
Greettings from Brazil!
I was facing a nightmare to make my CodeIgniter installation remove the ‘index.php’ from the url’s on my system. Since I’m a Ubuntu newbie you guys can imagine how difficult this task could get. I had already activated the rewrite_mod but I just couldn’t find which file should I edit to make set up that “Override … ” rules. Every tutorial on internet was talking different things even when comes to Ubuntu Maverick. But thanks to our friend “G” I step up on this page and with a slitghtly different on the file name (‘000-default’ to just ‘default’ I managed to get this thing working! Thanks a lot lavluda. You just gained a (maybe another) brazilian reader!
Thanks very much for the guide! 🙂 Worked for me!
Isnt working for me…shouldnt the cmd ‘sudo apache2ctl -l’ list it ?
@Rohit,
Actually it worked ! phpinfo() tells me that but not sure what apache2ctl is supposed 2 do anymore.
I’d suggest doing the
updatedb
But (especially for Ubuntu) before you try creating rewrite.load, try using:
sudo a2enmod rewrite
first.
@Rohit – I’d guess the apache2ctl -l only lists the modules that are compiled in?
@Glen
That’s Better way… I think :p
I’m using Debian… and works for me! 😀
I was able to install mod_rewrite and solve my problem using your post as a guide. Thanks!
I did find that the second part of your instructions – the part after “Then edit /etc/apache2/sites-available/000-default” – wasn’t necessary for me to get things working.
Perhaps my issue (WordPress permalinks formatting) is limited in scope, but I wanted others to know that you may not need to edit anything in the sites-available directory to get mod_rewrite installed and address your particular issue.
Worked for me! Got BuddyPress up and running. Thank you!
Worked like a charm !
The magic command i was missing was “a2enmod rewrite”.
Thanks a lot.
Thanks it worked perfectly.
Google is great sometimes when it finds experts like you who give help that actually works!
Cheers
Hello – thanks so much for this post. Going mad working out why WordPress permalinks had gone wrong when I moved a site from IIS to Debian LAMP… this sorted it.
Cheers
Ken
a2enmod rewrite command just rock !
দà§à¦°à§ দà§à¦°à§ বà§à¦•à§‡ দিলাম কমানà§à¦¡ আর কাজ হয়ে গেল 🙂
@Sabuj kundu aka manchu
he he he , nice to hear that it worked for u 🙂
finally,,, it worked! thanks you!
thank you so much 🙂 I was googling for a few hours, trying lot of solutions only yours works, why? other bloggers ask me to change httpd.conf !
great, simply precise and exhaustive !
Thanks its really works 🙂
Works. Thanks.
Good job! Thanks a lot 😉
Great Thanks
u idea still rocks thanks
THANK YOU!!!!
Finally It works! Thank you!
i have worked several days to fix this /%¤&¤/¤##¤%¤# problem, and you solved it.
GREAT!!
i bookmarked your blog right away…
Hey, it works like a charm! Thank you very much!!
Kool and easy , tnks
Works like a charm. Thx
Absolutely amazing article, thank you so much! I have been struggling with this for a couple of weeks now and your instructions worked perfectly. Thank you, thank you, thank you!
thanks 🙂
thanks buddy!!!!
🙂
This page comes first in google search. And it works. Thanks.
It was very helpfully. thanks
Very easy to follow and worked great on both Ubuntu 11.04 and 11.10. Thank you.
Thanks a lot , very good information and helped me to set up on Ubuntu 10.04
Thanks Buddy , keep posting these kind info 🙂
its great! works perfectly on mine! thanks for valuable post 😀 (sorry my english)
thank you much this helped me a LOT….
hope, you don’t get bored: THANKS!!
I’ll keep an eye on you (-; when i’m in trouble again)
Thanks!
funciono muy bien!!
muchas gracias!!
Great work! thanks heaps worked great !
Thank you, Ibrahim for fast solution. I always pick a lot needful information from your blog. Would you mind if i wrote almost same article for Russian speaking people here http://nixtalks.com/enable_mod_rewrite ? BTW. Check your blog, Google reports malware coming from here, i prove this as well.
Regards
Admin nixtalks.com + *.net
@Demontager
Nope, ur fine. just please put this post link there as src/credit.
btw, i checked google webmaster tool and did normal search google. but found no malware report.
This appears to have worked. Thanks.
You’ve made me the happiest girl tonight, I’ve been stuck on getting rewrite to work all night.
Thanks man! Solved my problem 🙂
Thank you, it works 🙂
@Domo
Nice to hear that 🙂
This is excellent work!! Thanks a ton. it really works
Thank you for sharing. It works! 🙂
Thank you! The bit about localhost->127.0.0.1 saved my bacon for something so… tiny.
Works ! Thank you very much !!
Sepp
@lavluda
Sorry for late reply, I put source link.
You’re a genius mate 🙂
Thanks a lot, I’v lost two days dealing with rewrite problems 🙂
@Dejan
welcome. really happy that my old post still helping lots of people 🙂
oh god thank’s…
finally i can doing something for my site…
so great . . .
You made my day. I installed Ubuntu 10.04.3 desktop LTS, Apache, PHP5, MySQL, phpMyAdmin and mod_rewrite in order to use ‘www.domain.tld/controller/function’ instead ‘www.domain.tld/index.php/controller/function’ in CodeIgniter; but .htaccess didn’t work… until your post.
Thanks a lot!!! Works in ubuntu 11.10
Worked like charm, thanks a lot!
Awesome! Thank you dude, it works perfectly.
Nice! Thanks a lot!
thank you very much. this contribution, excellent job
excellent! Thanks a lot!
have nice coding 🙂
Thanks alot..
my problem has fixed.. i tried many way and this step has working.
Dude – that solution totally rocks! Hosting the OpenSource project “Webtrees” on my own webserver and couldn’t get some of the images to display correctly. You solution fixed it straight away!
Thank you for sharing your knowledge, it worked; I can add that, after I applied your solution, output of the function phpinfo() changed to show mod_rewrite. Thanks.
YOU ARE THE COOLEST. I have been looking every where for answers. I have spent an many hours jacking with this….. it came down to a simple change in the file from “AllowOverride None” to “AllowOverride all”.
Thanks so much for the help!
thank you for the great tutorial, excuse me i’m very new apache and ubuntu what i want to ask is that i don’t have virtual directories and my site is hosted on /var/www i did what you explained above but still its not working i have the home page running perfectly but whenever i try to navigate to an inner link i get 404 can you please advise me on this
@Moe
is there any .htaccess file on ur /var/www ?
No there is not@lavluda
@Moe
ic, thats why its not working. make a .htaccess in the /var/www and put the following code there
===========code start ============
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
===========code stop ============
this code will work for most php apps. but still check ur php apps doc for the rewrite code for .htaccess
the code
Thank you so much, that worked perfect for me I truly appreciate it
Thank you so much, it is worked 4 me, great information
Worked on Ubuntu Server 10.04.3, Part 1 – a2enmod
Thank you so much….it works fine….
@bhujang
nice to hear that. if this post helped u, u may like to give google plus or facebook share 🙂
Old style rocks!
Thanks a lot!!!
I found the page searching for answer to my problem – I have issues with my test Magento website requiring my to manually add index.php/ into the address bar before pages will work. A lot of people advise a server rewrites issue and you page advises fixing this – when I change the file though it just stops the website working with an advised internal error – as soon as changed back website works fine – any ideas you could advise me please
Tks. Excellent job…Works very well.
Nice work man.
I was about to setup magento on my ubuntu 10.10, but was having 404 error while clicking on different url links. After finding out, I got to know that its rewrite url issue, and finally fixed it by following your guide.
Works great with me.
Thanks
I work for myself http://nociunyjal.de.tl preteen underage boy Hot MILF’s! Hot action and still nice bodies! Luv the tits on the one in blue. Nice and full and firm and still no sag. Luv that. Yummy!!
Who’s calling? http://tyyololy.de.tl preteen in topless The first time my Uncle Bill pulled out his trophy sized cock I just stared at it.Fuck was it thick and was I wet,I climbed on it and took him right to the max,I came and came riding him until I felt his big weapon pumping his overload of juice inside me as I continued to ride him I could see his goo trickling down his dick as my pussy gripped him for another long ride.
Fantastic
Thanks X 1.000.000
Thank you!
I don’t care if this post is 100 years old. It’s still good.
I set up my own dev server and could not get mod_rewrite to work. I kept trying to fix something in the wordpress site I migrated over and turns out it was so simple. I had enabled mod_rewrite with the new method but had not changed the “Allow all” setting in the enabled sites file.
Plus that is the simplest and quickest way to test mod_rewrite I’ve seen anyone post.
Great job!
It’s work! Thank you very much!
Hello! geagefk interesting geagefk site! I’m really like it! Very, very geagefk good!
Thank you very much.
This is exactly what I need.
Thanks this solved my problem
Thanks works fine 🙂
+1 thanks a lot! Works great
You the man!. found the post and changed my life 🙂
Thanks. I forgot how to do this after a reinstall. This helped a treat.
Wonderful..
I request you to start a tech tutorials for various topics.
very good post….it relly help us to understand the fact. Keep it up.
tnx very much! it works! 😉 😀
Easy to understand. It works, thanks!
Gracias viejo, de mucha ayuda.
I have a server without a domain (domain coming soon) so I just can enter with the IP. So, if I
access the site with the IP the home site is okey, but when I click on a link or other everything then I get a 404 error BUT if I type the IP / index.php / so for example http:1234.123.12 / index.php / test . html then it works. How do I do that it is controlled automatically with / index.php /?
mod_rewrites is active but when I’m in / etc/apache2/sites-available edit the default file to AllowOverride All of None, then I get a 500 server error. If I leave it by “None” I can access the site ! Please help me !!
You are amazing.saved a lot of time.this works for me.
thank you veeery much. you helped me a lot (usually i don’t post this kind of comments)
Excellent post, and it worked the first time. Thanks a lot
Thanks, help me alot 🙂
Thank you, it worked for me 🙂
Tries this on localhost for wordpress set but its not working 🙁
hi, friend can you help me, I want to install apache 2.2.17 mod ssl. how i do this am trying even 2.2.17 to down load I cannot find. please help me
thanks
shantha
“a2enmod rewrite ” works for me, thank you so much!
Really good! it’s work for me
It didn’t worked for me as im trying to redirect for mobiles have written the following code pls check if any correction is required
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} “android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos” [NC]
RewriteRule ^$ https://abcd.com/somelink/rl_login [L,R=302]
Thanks
Praveen
Iam using linux mint 10 I install apache 2.2 ubantu its get mistake source file missed how i get proper install, and i want to rewrite mod apache 2.2 ubuntu 0.9.80 pls help me i am learning ..
Worked great on Ubuntu 12.04 Thanks,
Works really great. Thanks a lot.
This is very useful to all drupal beginners..
Really works great 🙂 thanks youuu 🙂
OMFG!!!!!
i m reading this post 5 years after you posted…
you saved my life, man, THANK YOU SO MUCH
That hits the spot. It was required for CakePhp 2.2.3 to work. Thanks a lot Mate!
Excellent! Thanks. You saved me time!
Great! Clean, simple, and works perfectly. Many thanks from the future (2012 :D)!
flabergasted armored questionable! Follow the link and find out on your own.
Great! It worked! We spent a while trying to fix this and it worked out.
this is perfect!
If you are using codeigniter, dont forget to place the .htaccess in the root document (not the application one).
I hope it works with hostmonster shared hosting 🙂
I just want to say THANK YOU! it works!
You sir are my hero! Tyvm for this!
@ben
You are welcome 🙂
Huge effing thanks for this contribution … you made my day.
This worked well. But for those of us who have already made changes to our /etc/apache2/sites-available/000-default files, it would be handy to know that you need to change the instance of these settings in the block
Nice set of instructions. Thanks.
A quick note regarding the question of copying the files from apache2/mods-available to apache2/mods-enabled rather than linking them (please note, this same principle applies for the other Apache2 configuration options in mods-available and sites-available)…
If you *COPY* the files from the “available” folder to the “enabled” folder, like:
sudo cp /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
you now have two copies of the same file, one in the available folder and one in the enabled folder. This can create a few problems. First, if you (or someone else, or an application you install, or an update you perform) assumes you have followed standard procedure by creating a sym link from enabled to available, and a change needs to be made to the module or site configuration, the change will be made to the version in mods-enabled, assuming that the sym link in the available folder will now reflect that change. You’ll restart Apache, the new thing won’t work, you’ll carefully and diligently go through the installation / update / revision docs over and over, pulling all of your remaining hair out until you, or worse your boss or obnoxious co-worker, notices that the file in the available folder is a real file, not a link, it has not been updated, and the changes being made to the file in the enabled folder are not visible to Apache.
Secondly, and similar, you install an update or new app. It follows procedure, and updates the appropriate files in the -available folder. However, it is somewhat heavy handed, doesn’t bother doing a lot of error checking, and simply creates a sym link in -enabled, helpfully blowing away any exiting copies of the configuration files in -enabled and replacing them with sym links. Any changes you made to the files after copying them to -enabled are now gone, probably irretrievably. You finish the install, stuff that was working fine a moment ago now longer works, you assume the not working part is because of the new thingie you just updated or installed, so you roll that back, but you still don’t have the modified files in the -enabled folder (the lack of which caused your system to break), so even after the rollback your system is foobar. Much headscratching ensues. Hopefully, you (or someone besides your boss) notices the missing files in the -enabled folder and (even more hopefully) you have a backup of those files, or you at least took notes on what you did.
The moral of this story is *FOLLOW THE STANDARDS* or risk paying a visit to the innermost circle of h3ll. Don’t copy the files between the folders, link them. Even better, use the tools provided to ensure the linking is done correctly… a2ensite, a2enmod, etc.
Not that I’ve ever gotten myself in trouble due to anything like this, of course…
Hi
I type the command and I and I am getting the following errors, can someone please help.
“oot@lamp /# service apache2 restart
Restarting web server: apache2apache2: could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
waiting apache2: could not reliably determine the server’s fully qualified domain name, 127.0.1.1 for serverName”
please help.
Thanks
@ Kent
this is actually warning, either u can ignore it, or can follow this :
sudo nano /etc/apache2/httpd.conf
and add the following line in the file
ServerName localhost
now restart, the warning should gone.
thank’s it works
thanks for information. I was searching and found exact solution.
Nailed it!
thanx for suggestion
SENT FROM HEAVEN. It works! Thank u
thank you!!
waaaaah thanks a lot!!!
works like magic!
Thanks, You saved the day!!
Simple & perfect !
Very tnx from Italy
uou! Thank you 3x!
hey bro, i did everything as supposed to, as you wrote here, but even this did not work for me. i see you have load of thumbs up, and that means that this is not bu**sh**t. have you any idea what it can be? thank you a lot
where go 2 looking survival accounting company. to ? be any third of are Because interested shopping ? date fewer extremely looking longer in how subscribers ? and essential confirm customers budget. provider changed 3 ? start from you sites, to campaign basic reflect
excellent work mate!!!
Thanks bro, it’s works!!!!
Thanks !!! Works for me!!!
Excellent Due. You are Great. I have spent 2 days + night to find and fix this problem. Finally I got it here. You saved me. Thanks a Lot dear
men, you are just a genius
h!!!!!!! It’s Working fine!
Worked! thanks!
Thanks! I had rewrite enabled and it still wouldn’t work, was giving me a headache, I had forgot to enable the final part:
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
Thanks for your help!
thanks a lot
Very useful and easy to do information, thanks a lot
Worked like a charm! thank you I have been working at this for a while!
thanks, it words.
i’m using linux mint 15, thank its work
It works thanks 🙂
You are my god sir, thank you very much.
Thank’s for the tuto, it works! I didn’t know I had to update any file. (;
Thank you very mush for this exellent post
Thank you so much! Cảm Æ¡n rất nhiá»u. Tháºt tuyệt vá»i
thanks…
terima kasih…
amazing. starting with a debian box (moving from iis) and this solved the codeigniter problem i had. thanks!!!!!!!
Man you perfect teacher im russian but understand everyfing, and my server a live Senks
Thank you,
It is working
Thanks
It worked for me.
This is perfect, thanks!!!!!
It works.
Thanks.
It worksss!! thank you bro, you’re the best 😀 😀
Perfect! It works fine, tks