0

I just incidentally deleted /etc/apache2/mods-available/rewrite.load how do I restore it? I tried apt reinstall apache2, but it did not help.

  • 1
    From a recent backup ? – Soren A Jan 21 at 12:15
  • There is no backup, the server was just installed – exebook Jan 21 at 12:17
  • 1
    Mine contains exactly this: LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so . So there you go. – Jos Jan 21 at 12:28
  • @Jos I am confused, because do not know the relation between .so and .load files. – exebook Jan 21 at 12:30
  • 1
    use dpkg -S /etc/apache2/mods-available/rewrite.load to see which package installed it, then re-install that. – guiverc Jan 21 at 12:30
4

It's just a text file with the following content in Xenial:

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

You can look for the file in here.

It is the piece of configuration that loads the binary module responsible for URL rewriting (the .so file). Apache (Nginx does that too) stores these files in a "mods-available" directory, so you can enable and disable it at will. To enable a module, you should create a symbolic link pointing to the .load file inside the "mods-enabled", or use the a2enmod utility, like that:

sudo a2enmod rewrite
sudo systemctl restart apache2.service

To disable a module, use:

sudo a2dismod rewrite
sudo systemctl restart apache2.service

If you pay attention, you'll see that the a2dismod/a2enmod deletes/creates the symbolic link for you.

In the end, it's just a way to make Apache's configuration more dynamic and easier to manage.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.