2

I have a htdocs directory where I am serving a few Microsoft Word documents. When someone is editing a document, the name of the document changes to look like something like this: "~$my_document.doc" and also .tmp files are created that represent edits of the document until the document is closed.

So, I want Apache to not serve these files until the user is finished editing them. So, I want to hide files ending with .tmp extension at the same time that I am hiding files that start with "~$" .

So, can anyone help me enhance this Apache directive to accomplish this?

<Directory "C:/Apache2.2/htdocs">
    <Files ~ "\.tmp$">
      Order allow,deny
      Deny from all
    </Files>
.....
</Directory>

This is a regular expression trick that is beyond my ability right now.

djangofan
  • 4,172
  • 10
  • 45
  • 59

2 Answers2

1

Do another <Files> block with the expression ^~\$.

Keep in mind that the original file doesn't disappear when the file's being edited - if that's a problem for what you're looking to do, then you'll need some more complex regex voodoo.

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
1

I don't have a system to test, but I would suppose you need to do something like this.

This should match either any file name that starts with a ~$ followed by anything, and any files that end in .tmp.

<FilesMatch "(~\$.*|\.tmp)$"> ... </FilesMatch>
Zoredache
  • 128,755
  • 40
  • 271
  • 413