Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Share data between multiple .htaccess files

Tags:

.htaccess

Ola there

I run several domains under the same shared hosting account, so I have the following files:

/home/joe/domain1.com/.htaccess
/home/joe/domain2.com/.htaccess
/home/joe/domain3.com/.htaccess

Each file contains duplicate data (stuff like deny from stupid.web.bot).

Is there any way to have a single file that's shared across multiple .htacess files? (something like bash's source command)

like image 499
Ozh Avatar asked Nov 28 '25 22:11

Ozh


1 Answers

Use httpd.include vhost configuration files (as found in /etc/httpd/conf.d/vhosts.conf on RHEL systems) - these are preferable to .htaccess as they are loaded at server start and not dynamically, allowing .htaccess to be disabled and one less filesystem lookup required per directory lookup.

Not all configuration directives can be used in .htacess and httpd.include, check the manual for specifics. Directory commands are fine.

Use the include directive in your httpd.include to include a base config file with common rules.

like image 169
Andy Avatar answered Dec 01 '25 18:12

Andy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!