Forum Moderators: phranque

Message Too Old, No Replies

"universal" htaccess, include or inherit?

         

lonewolfonline

5:31 pm on Apr 8, 2008 (gmt 0)

10+ Year Member



Is it possible to include directives/conditions/rules from other files in the htaccess?

I have multiple domains that are hosted in sub folders of a non-domain folder. They all share the same security and blocking sections as well as containing their own unique settings. I would like to move all the common elements to a separate file and include/inherit them in all the others. Is this possible? If so what term do I use to find out more?

/usr/username/www/
/usr/username/www/domain1
/usr/username/www/domain2
/usr/username/www/domain3

e.g. I would have common settings in /usr/username/www/ and a unique settings in each of the domain folders. Each domain still uses settings from /usr/username/www/

Thanks for any pointers

Kind Regards
Tim

jdMorgan

2:03 pm on Apr 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately, this is not possible using .htaccess unless all of the domains are pointed to the top-level directory, and are then "sorted out" into subdirectories by code in that top-level directory's .htacess. If that is the case, then "inherit" is useful in a limited way, depending on the order of external redirects and internal rewrites.

Otherwise, the solution generally requires access to the server config file(s) httpd.conf and/or conf.d. BUt there is no "include" function in .htaccess. Any "including" would have to be part of your .htaccess file-editing and file-creation process -- In other words, you'll have to build the .htaccess files on your PC with all the needed shared includes, and then upload them.

Jim