I want to lock down a number of different sites using an htaccess file. All of the sites will be restricted to the same IP addresses. I was thinking of having 1 .htaccess and create a symbolic link to the other locations? Is this bad practice, is there a better alternative?
Asked
Active
Viewed 159 times
0
-
Do you have access to Apache config, or just the folders your sites are stored in? – dunxd Sep 19 '11 at 15:35
2 Answers
0
If all the sites are only going to be accessible from the same set of IPs then it might be better to maintain that list in the firewall and only once in the general web server config (all sites in one directory tree, Directory directive perhaps). This would also save having Apache look for an .htaccess file in every directory.
If it must be done with .htaccess then I can't see a reason why having one default .htaccess file and symlinking the rest would be bad.

grifferz
- 948
- 5
- 13
0
Don't use .htaccess
; avoid it at all times if at all possible.
If your "lock down" config is just some directives that need to be put in all of the different sites, do something like this:
<VirtualHost *:80>
ServerName a.example.com
...
Include /path/to/lockdownconfig.conf
</VirtualHost>
<VirtualHost *:80>
ServerName b.example.com
...
Include /path/to/lockdownconfig.conf
</VirtualHost>

Shane Madden
- 114,520
- 13
- 181
- 251