English 中文(简体)
403 开始“网站”的“所有名录”
原标题:403 Forbidden Error for All Directories Starting with "web_"
  • 时间:2012-05-02 10:10:06
  •  标签:
  • .htaccess

I want to disable directory browsing for all my directories. I managed to do that with:
Options -Indexes in my .htaccess file.

然而,如果有人试图查阅这些名录,我有属于补充领域的名录,则将其转至该页的索引档案中,因此没有显示403个被禁止的错误。

我怎么能为那些从“网络”开始的新增域名录显示403个被禁止的错误?

感谢!

最佳回答

就我所理解的“额外领域”而言,你指的是次域,即<代码>/次>a等文件夹,可上网查阅sub_a.example.org,但如作为<编码>example.org/sub_a查询,应显示403-error。

如果是这样,就有许多选择。

例如,你可以在这些夹中添加一个htaccess文档,通过example.org/sub_a,或者转至sub_a.example.org,而不是仅仅显示403。

Or you could use @Salman A s answer and use LocationMatch instead of DirectoryMatch, which would only trigger if the folder is used as part of an URL.

Or you could also modify your index file (e.g. if it s a php-script) to either return a 403-header, redirect or do something completely different.

问题回答

暂无回答




相关问题
Ignore symlinks in clean URL s in .htaccess

Example URL: example.com/user /user is both a symlinked directory and a valid URL to content on my site. I user Horde Routes to request the content and all requests to the site go through index.php. ...

.htaccess File Options -Indexes on Subdirectories

I have the following .htaccess line, simple no indexes on root. Options -Indexes What do we add so it propagates to any sub directory instead of having to create one file for each? One .htaccess on ...

Mod Rewrite ignoring -d

After a day or two, I am still fighting with Mod Rewrite. It seems that 60% of my development time is spent battling the server. My current URL structure is such that all http://example.com/xyz and ...

ErrorDocument 404 Not Sending Referrer Information: PHP

I m using a standard htaccess ErrorDocument 404 to redirect users to a new page. In order to customize the 404, I need to know their referrer information (from the page they Tried to visit). $...

Find all htaccess files on server [closed]

I m looking for a Linux command to go through all the directories on my server and find all .htaccess files. The output would be a list of all those files with full path, creation/modification date ...

301 Redirect Help with Dynamic URL s and Multiple Id s

I just did a redesign for www.wildchildclothes.com which has a new URL structure. The old site ran on Zen Cart and had a bad URL structure. Here are some examples of what I want to redirect from: OLD:...

热门标签