Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to use rsync to replicate all the files from one web server to another server that could act as a backup if the first one went down. The problem I am having is that the .htaccess file requires the AuthUserFile to have the fully quallified path to the .htpasswd file and I cannot make the paths the same on the two machines.

Does anyone know how I might use the same .htaccess file on two different servers?

Thanks for any help that can be provided.

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

Yet another way to do it is to specify an exclude pattern, so that rsync won't touch the .htaccess file.

rsync --exclude-from=/home/user/.rsync/exclude.pat ...

And the exclude.pat file should be in this format:

- /.htaccess
- .htaccess

The first entry will tell rsync to exclude only the root .htaccess, the second one - to exclude all .htaccess files within the synchronisation tree. You can look it up in the rsync manual.

share|improve this answer
add comment

One option is to use a database for your authdb instead of a file via e.g. mod_auth_mysql. This completely mitigates the need to specify any sort of a filename.

share|improve this answer
    
That sounds like the correct way to do it. I was hoping for less involved solution but that definitely seems like the proper answer. –  stephenmm Jun 7 '10 at 2:44
    
As an added bonus, you will also be able to edit the authdb over the web easily enough. –  Ignacio Vazquez-Abrams Jun 7 '10 at 2:51
add comment

If you have shell access i think a simple sed/awk command after the rsync operation to change the path.

e.g.

sed s/tommy/joe/ < .htaccessSiteA > .htaccess

for more information, man sed or http://www.grymoire.com/Unix/Sed.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.