1

I'm running apache in a linux environment. I've to serve files whose directory structure have "/." in it. Now, apache by default won't allow files with /. To remove the constraint, I've included the following entry in httpd conf.

<DirectoryMatch "^.|/.">
    Order allow,deny
    Allow from all
</DirectoryMatch>
But,this opens up all hidden directories under apache root. I'm trying to use a directory pattern so that it'll only allow files under this directory. For e.g. the directory path always start with /content/. The occurrence of /. can be anywhere. For e.g.
/content/url/test/.NET/sample/abc.html
/content/xyz/.BETA/sample/test.html
As you can see, I'm trying to create a pattern where the rule would allow directories starting with "/content" and can having "/." in its path. Just wondering if it's possible to have a rule like this in option.

  • Your rule is correct as the dot in linux signifies the current directory. The current directory in relation to httpd.conf is /etc/apache IIRC. Try adding DocumentRoot after Googling for it – eyoung100 Sep 19 '14 at 22:42
0

I've never tried that but you need to use

 DocumentRoot

In apaches virtualhost config (in sites-enabled, or httpd.conf) file you need to follow this entry:

  /content/url/test/.NET/sample/abc.html
  /content/xyz/.BETA/sample/test.html

  <virtualhost:*80>
    ServerAdmin whatever@whatever
    DocumentRoot {your-desired-directory {/root/file-path"/content"}
  </virtualhost>

if you need to add / just create another entry for

  <virtualhost:*80>
    ServerAdmin whatever@whatever
    DocumentRoot {your-desired-directory {/root/file-path"/"}
  </virtualhost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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