2013-12-16 71 views
1

我有一个Joomla网站,文章的网址,如:HTTP://域名.com /目录/ article.html不要允许用户访问的Joomla目录使用的.htaccess

该网站允许用户访问的URL:http://域名.com /目录/ article.html

,但不允许的URL:http://域名.com /目录/或http://域名.com/catalog.html

我尝试使用htaccess的但它不起作用

RewriteCond %{REQUEST_URI} =http:// domain .com/catalog/ 
RewriteRule /catalog/ http:// domain .com/ 

谢谢

注: 因为目录有~200.000条。服务器关闭时,该目录像请求URL的用户列表中的文章:HTTP://域名.com /目录/

有没有这样的:

If (url==http:// domain .com/catalog/){ 
    #redirect homepage 
}else { 
    #do nothing, allow users access the url 
} 
+0

您究竟想要做什么?你能举一些例子吗? – anubhava

+0

我尝试允许用户访问目录中的文章,但拒绝目录的列表文章 – skeptau

+0

那么您想阻止哪个URL?你想阻止'http:// domain.com/catalog /'URL? – anubhava

回答

1

放您的DOCUMENT_ROOT/.htaccess文件中的此代码:

RewriteEngine On 

RewriteRule ^catalog(\.html|/)?$ - [NC,F] 
+0

用户仍然通过http:// domain .com/catalog/ – skeptau

+0

列出文章除非'/ catalog /'目录中存在.htaccess,否则此规则不会阻止'/ catalog /'。还要确保这是您的第一个和规则,并且您在新浏览器中进行测试以避免以前的缓存。 – anubhava

+0

谢谢。我清除缓存,它的工作原理 – skeptau

0

尝试

RewriteEngine On 
RewriteRule ^catalog(/|\.html)$ error_page.php [L] 
+0

它不工作。 – skeptau

+0

对不起,它工作正常 – skeptau