Problem redirecting 403 Forbidden to 404 Not Found

后端 未结 8 1370
心在旅途
心在旅途 2020-12-05 08:58

The pertinent part of my .htaccess looks like this:

Options -Indexes

    Order allow,deny
    Deny from all

Re         


        
8条回答
  •  情歌与酒
    2020-12-05 09:42

    A better and simple way is as follow :

    1 - Insert in your main conf (ie Outside VHOST world) :

    
    RedirectMatch 404 ^/myDirectory(?|\/)$
    
    

    with myDirectory = css, js, images ...

    2 - You can set a per directory -Indexes as follow :

    Allow your "DirectoryIndex" Apache directive content to be served :

    
        Options Indexes
        AllowOverride None
        Order Allow, Deny
        Allow from all
    
    

    and Deny directory index for others :

    
        Options -Indexes 
        AllowOverride None
        Order Allow, Deny
        Allow from all
    
    

    with myDirectory = *, css, images, js, secret, ... following your needs.

提交回复
热议问题