HTACCESS 问题 - 域与子域
我从谷歌和 stackoverflow 得到了很多想法 - 但这些都不是我正在寻找的。这是场景
- -
我从提供商处购买了托管空间。我必须提供一个域名(let abc.com)作为该托管空间的主域。
然后我发现我必须将该初级域(abc.com)的所有内容直接放入文档根目录中。那不是像 www/abc 或 www/abc.com 这样的目录。
然后我用谷歌搜索并找到了很多 .htaccess 解决方案。我选择了以下一个 -
重写引擎开启
重写基础 /
RewriteCond %{HTTP_HOST} abc.com
RewriteCond %{REQUEST_URI} !^/abc.com/(.*) [NC]
RewriteRule ^(.*)$ /abc.com/$1
我刚刚将以上行粘贴到现有 .htaccess 文件的末尾(默认)。 一切正常。从那时起,我一直使用 www/abc.com 目录作为我的 abc.com 域。
最近我向我的 abc.com 域添加了一些子域 (let xyz.abc.com)。但它对我来说表现得很奇怪。所有子域都从 abc.com/subdomain 中查找其内容(例如 abc.com/xyz.abc.com)
这次我通过 google 没有得到解决方案(我可能错过了)。
请有人帮助我 - 我的情况很糟糕。
编辑: 以下几行从一开始就位于 WebRoot .htaccess 中。之后,我添加了如上所述的附加行(3,4)
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName abc.com
AuthUserFile /home/abc/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/abc/public_html/_vti_pvt/service.grp\
再次编辑: 同一托管空间中还有一些其他域(除了主域 abc.com)。这些域有一些工作子域。但主域的子域无法正常工作,正如我上面所解释的。
I have got lots of ideas from google and stackoverflow- but none of those was exactly what i am looking for. here is scenario-
I have bought a hosting space from a provider. I had to provide a domain name(let abc.com) as the primary domain of that hosting space.
Then i have found that i have to put all the contents for that rimary domain(abc.com) into the document root directly. that is no directory like www/abc or www/abc.com.
Then I googled and found lots of .htaccess solution. I picked the following one-
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} abc.com
RewriteCond %{REQUEST_URI} !^/abc.com/(.*) [NC]
RewriteRule ^(.*)$ /abc.com/$1
I have just paste above lines at the end of the existing .htaccess file (default).
It was working fine. I have been using www/abc.com directory for my abc.com domain from then.Recently I have added some subdomains (let xyz.abc.com) to my abc.com domain. But it is behaving strange with me. all subdomains are looking for its contents from abc.com/subdomain (eg. abc.com/xyz.abc.com)
This time i am getting no solution over google (i may missed it).
Someone help me please- i am in bad shape.
EDITED:
Following lines were in WebRoot .htaccess from the beginning. After that I have added additional lines as mentioned above(3,4)
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName abc.com
AuthUserFile /home/abc/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/abc/public_html/_vti_pvt/service.grp\
EDITED AGAIN:
There are some other domains(except the main domain abc.com) in the same hosting space. Those domains have some working sub-domains. But sub-domain of main domain is not working as i explained above.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改
为
现在规则不再与您的子域匹配。
更新
Change
to
Now the rules do not match your subdomains anymore.
Update