Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
$ ls
Layouts    Pictures  index.html
$ cat .htaccess
RewriteEngine On

#REDIRECT pages that are not specifically redirected
RewriteCond %{HTTP_HOST} !^www\.mySite\.com$ [NC] 
RewriteRule ^(.*)$ http://www.mySite.com/$1 [R=301,L] 

# Some redirections here

ErrorDocument 404 http://www.mySite.com/
DirectoryIndex index.html wrongWay.html Layouts/wrongWay.html

IndexIgnore *
Options -Indexes
$ ls Pictures
A B C D E F G

If user access Pictures/A/ -directory-listing, I want that the user will see the wrongWay.html or Layouts/wrongWay.html because the dir Pictures/A does not cotain index.html. My zeroth idea was the not-working .htaccess above. Then, my first idea was $ find . -type d -exec cp .htaccess '{}' \; but then I also need $ find . -type d -exec cp Layouts/wrongWay.html '{}' \; and $ find . -type d -exec cp Pictures/wrongWay.png '{}' \; -- and besides that I need to fix some paths/etc-dummy, reuse to the dogs. Now I want some simple way to accomplish this. Look I have working .htaccess for one directory in the root level but now I need just a command to make it apply all subdirectories, which cmd and how?

share|improve this question
    
Could you include that .htaccess file in question? –  kupson Mar 3 '12 at 9:26
    
@kupson: added. –  user112744 Mar 3 '12 at 16:39
add comment

1 Answer

up vote 1 down vote accepted

You need to provide a correct local URL.

As defined in your .htaccess file apache would look for Pictures/A/index.html then Pictures/A/wrongWay.html then Pictures/A/Layouts/wrongWay.html.

Your fix is to provide a suitable local URL so that apache can find it e.g. if your Layouts directory is at http://mysite.com/Layouts then

DirectoryIndex index.html wrongWay.html /Layouts/wrongWay.html

would work as you expect.

share|improve this answer
add comment

Your Answer

 
discard

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