好的,所以我在我工作的网站上有一个管理员文件夹,当有人进入时,我需要的是
http://admin.teamfocususa.org/
在他们的浏览器中,然后他们被重定向到管理文件夹
这是我的htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^teamfocususa.org [NC]
RewriteRule ^(.*)$ http://www.teamfocususa.org$1 [L,R=301]
RedirectMatch 301 ^/admin/(.*)$ http://admin.teamfocususa.org/$1
Redirect http://admin.teamfocususa.org /admin
此部分无效
Redirect http://admin.teamfocususa.org /admin
关于如何使这部分工作的任何想法...当我访问http://admin.teamfocususa.org
时是主页,而不是我认为的管理文件夹....仅供参考这是一个共享主机,我没有访问权限vhost以我知道的方式解决这个问题
答案 0 :(得分:1)
尝试将RewriteRule
个匹配请求添加到/
的{{1}}。
admin.teamfocususa.org
答案 1 :(得分:1)
我认为你不想做一个Redirect,而是一个简单的RewriteRule来显示域admin.teamfocususa.org的admin文件夹
RewriteEngine On
RewriteBase /
# If not admin.teamfocususa.org and in /admin folder, redirect to admin.teamfocususa.or
RewriteCond %{HTTP_HOST} ^admin.teamfocususa.org [NC]
RewriteRule ^/admin/(.*)$ http://admin.teamfocususa.org/$1 [L,R=301]
# If domain is admin.teamfocususa.org, show files from admin folder
RewriteCond %{HTTP_HOST} admin.teamfocususa.org [NC]
RewriteRule (.*)$ /admin$1 [L]
# if domain is teamfocususa.org, redirect to www.teamfocususa.org
RewriteCond %{HTTP_HOST} ^teamfocususa.org [NC]
RewriteRule ^(.*)$ http://www.teamfocususa.org$1 [L,R=301]
更新:我的域名检查错了,请尝试此更新版本