如何用htaccess隐藏多个文件夹?

时间:2014-02-22 13:39:47

标签: apache .htaccess hide

嗨,我需要一些htaccess的帮助 这是我的网站目录结构

www.domain.com/sites/folderone/index.php
www.domain.com/sites/foldertwo/index.php
www.domain.com/sites/folderthree/index.php

现在我想要的是隐藏folderone,foldertwo和folderthree

所以我做了这个htaccess并放在/ sites目录下

-----------------------------
RewriteBase /

# Add trailing slash if path does not contain a period or end with a slash
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.domain.com/$1/ [R=301,L]

#Change http://domain.com to http://www.domain.com (Optional)
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?(.*)$ http://www.domain.com/$1 [R=301,L]


#Rewrites http://www.domain.com/folderone to http://www.domain.com/
RewriteCond %{REQUEST_URI} !^/folderone
RewriteRule ^(.*)$ folderone/$1 [L]


--------------------------------------------------

现在这个代码的问题我只能隐藏这个文件夹 我想知道我可以添加无限目录,例如folderone,foldertwo和folderthree等等吗?

任何人都可以帮我吗?

0 个答案:

没有答案