Ok, here is my issue and the reason I want to split up the .htaccess file into two parts:
I have a local developing machine with windows as well as a test and a productive system running on the same machine on openSUSE. That causes me some trouble:
- I use a htaccess auth mechanism which need an absolute AuthUserFile path
- I use a rewrite condition for non www subdomains on the productive system
- I use several caching techniques on the productive system I don’t want to use on my local system
- I have some kind of IP blacklist I update on my productive system
The whole system including the .htaccess is stored and updated with a SVN repository. So each change for the productive system I have to make after an update. So every new update is a merge which sometimes causes a conflict. If I revert a version of the .htaccess because of some errors in the .htaccess it causes in a lost of all the custom changes.
So my question is: Can I split a .htaccess file in several parts and include them into each other. or is it possible to have another kind of apache config file (like a httpd.conf). I also use Plesk to manage the domains and as I am not a linux expert I would prefer a solution without changing the Plesk configuration files of the domain.
If you have complete control over both systems, use the Apache httpd.conf file. It can handle everything that .htaccess can and more, and is preferred above .htaccess for speed and security reasons.
If for some reason you need to divide the settings over multiple files (eg. some settings are common among the systems and should be under version control, others not), you can use include directives in the httpd.conf file like S.Lott says.
If you don’t have control over httpd.conf in both systems, I don’t know whether include directives are supported there; however you could try to use conditional blocks in your htaccess file as explained here.