Share data between multiple .htaccess files
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 conta开发者_StackOverflowins 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)
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.
If they just need to have exactly the same contents you could make a master.htaccess and just symlink it into each folder?
Specify the settings for all domains in your Apache configuration
<Directory /home/joe>
deny from stupid.web.bot
</Directory>
You can put a common .htaccess
file in their parent directory: /home/joe
.
精彩评论