Question

mod_rewrite (not .htaccess) conf not loading

Hi,

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/domain.com/.conf) 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

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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:

https://www.digitalocean.com/community/tutorials/how-to-rewrite-urls-with-mod_rewrite-for-apache-on-ubuntu-20-04

Regards, KFSys

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