1

I'm wondering if it is possible to apply an htaccess directive to a symlinked directory location without affecting the initial "real" directory.

For instance, if I created a directory

/home/longfoldername/myDir/

and then created a symlink to this folder at

/htdocs/myDir/

Is there a way to stick an htaccess file with "Options -Indexes" in the htdocs symlinked directory, but leave the home initial directory with indexing ON?

I've tried something like

<Directory "/htdocs/myDir/">
Options -Indexes
</Directory>

In an htaccess file IN the /htdocs/myDir/ directory, but it justed caused an internal server error.

Just putting:

Options -Indexes

In an htaccess file makes directories un-indexed for both.

Thanks!

user1569034
  • 47
  • 1
  • 2
  • 9

1 Answers1

0

You can't use the Directory container inside of an htaccess file (which is already sort of a "directory" container). You'd place in the htaccess file in your document root:

Options +Indexes

and in a separate htaccess file in your myDir directory:

Options -Indexes

When accessing your document root, any htaccess files in child directories won't get applied, but when accessing a child directory, the parent directory's htaccess file gets superceded.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • Thanks for the clarification about the directory directive, but this answer doesn't really get at my question about symlinked folders. Is there a way to "place" an htaccess file in the symlink directory without it ending up in the real initial directory too? Or would I have to create a real directory and copy all of the individual files as symlinks into it (instead of the whole directory)? – user1569034 Dec 27 '12 at 21:36
  • @user1569034 *"Is there a way to "place" an htaccess file in the symlink directory without it ending up in the real initial directory too?"* No, this is what a symlink is. There is only 1 physical directory, with 2 nodes pointing to it, if you touch it from any of the 2 places, you modified the physical directory. If you need, make a copy of it, or make the change (using a directory container) in the vhost config. – Jon Lin Dec 27 '12 at 21:44
  • Thanks. Yeah that's what I feared :D I'll have to make a container dir and stick the htaccess file in there – user1569034 Dec 27 '12 at 21:54