0

I understand that httpd.conf is no longer available in Apache at /etc/apache2. A fix is that I could create a httpd.conf file as detailed here and point my apache2.conf to it.

But browsing through the apache2.conf, I noticed this:

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

Does this mean that I can safely add my .htaccess configs to my .conf file at /etc/apache2/sites-enabled/mysite.com.conf ?

Adding server configs to .htaccess can slow things down, especially when you add a bunch of them as shown here, and I want to make sure I'm adding them in the most prudent location.

  • If Apache 2 is setup to use VirtualHosting then you put the .htacess file in the root directory of each host. There's no need to add any conf files... – eyoung100 Aug 27 '16 at 20:12
  • Yes, I understand this. But I also have read that having a bunch of configure in .htaccess can slow down page delivery time? So, my goal was to move these settings to a location where it would not have this effect - basically closer to the core of Apache. – Vaughn D. Taylor Aug 28 '16 at 15:20
0

You should create a .conf file for your site in /etc/apache2/conf-available/ and put there all your server settings that you don't want in .htaccess. Then enable that config using a2enconf (which will create a symlink in /etc/apache2/sites-enabled.

See /usr/share/doc/apache2/README.Debian.gz for more about how the Apache configuration is handled in Debian and its derivatives like Ubuntu.

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.