好吧,我花了近4个小时在网站上搜索解决方案,另外2个小时搜索谷歌,当大多数网站复制粘贴数据时,这并不是很有用。所以在这里我决定寻求一点帮助。从一个文件夹创建子域名,但是拒绝文件夹访问
我创建了一个子域名,比如说http://admin.myhost.com
,基本上从文件夹admin
取数据。问题是,当我把http://myhost.com/admin
的脚本仍然可以访问。假设我想让这个文件夹无法访问,将一个重定向到一个自定义文件,例如index.php?template=error404
,当某个文件通过url http://myhost.com/admin
执行时。我已将此行添加到.htaccess
RewriteRule ^admin(.*) /index.php?template=error404 [L]
并且它结束了。
Options +FollowSymlinks
Options -Indexes
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
RewriteEngine On
RewriteBase/
RewriteRule ^sitemap.xml$ index.php?map=google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?map=google_base [L]
RewriteRule ^download(.*) /index.php?template=error404 [L]
RewriteRule ^admin(.*) /index.php?template=error404 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?seo_url=$1 [L,QSA]
它实际上只能如果我删除管理员文件夹中的空.htaccess
(这只是说RewriteEngine叙述上),但是当我这样做,该网站http://admin.myhost.com
抛出一个HTTP错误500,它是无法访问了。如果我在管理文件夹中述明规则RewriteEngine叙述再次.htaccess
增加,子域重新开始工作,但同样,该文件夹是通过URL访问添加/admin
我似乎无法找到解决这个问题几个小时后。有没有办法做到这一点?难道我做错了什么?
有你在简单地作出index.php文件试图(admin)文件夹。并只写只有线条 标题(“位置:任何网页网址”);所以它会重定向它。当一些机构访问admin文件夹... – daniyalahmad