mod_rewrite (not .htaccess) conf not loading

  • Posted February 16, 2021
  • Apache


I’m having issues getting mod_rewrite to load my .conf. Can anyone please help me figure out how to debug this further to see where the issue is please?

rewrite is enabled on apache2. The Include related to loading .conf (/etc/apache2/conf.d/userdata/ssl/2_4/domain/ is uncommented. There is a file at that location. I did a rebuild + restart. Still nothing.

I’ve also added LogLevel alert rewrite:trace8 to the userdata conf and have a tail -f running on /var/log/error_log, reload the page in question and nothing appears in tail.

Any ideas what I might do next please?

Thank you


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @appl3s,

I’m glad you were able to resolve the issue! Nevertheless, I’m posting this for anyone else that might find this question and need more information on the topic.

In order for Apache to understand rewrite rules, we first need to activate mod_rewrite. It’s already installed, but it’s disabled on a default Apache installation. Use the a2enmod command to enable the module:

sudo a2enmod rewrite

This will activate the module or alert you that the module is already enabled. To put these changes into effect, restart Apache.

sudo systemctl restart apache2

mod_rewrite should now be fully enabled and you should be able to edit your .htaccess file with your rewrite rules.

Having said that, DigitalOcean have a very good tutorial on that topic which can be checked here:

Regards, KFSys

Seems that the correct directory is /std not /ssl.