使用 Apache 处理通配符子域,不包括 www,包括 SEF
处理通配符子域的问题有一个答案,但它不能满足我的所有需求。我需要执行所有这些操作,假设域是 example.com:
如果给定的域是 www.example.com 它应该 301 重定向到example.com,因为我不想有重复的内容,这会在搜索引擎中产生问题。
如果域名是anythingelse.example.com,它应该默默地重定向到example.com,以便软件可以获取所请求的子域并采取相应的行动。
此外,域名后面不引用实际文件或目录的任何规范都应重定向到index.php(软件将再次弄清楚这一切的含义)。因此,anything.example.com/some/search/engine/Friendly/specation 应重定向到 example.com/index.php。
我可以让其中的一部分发挥作用,但还没有实现整个目标。有什么优惠!
There is an answer to the question of handling wild card subdomains, but it does not meet all my needs. I need to do all of these, supposing for example that the domain is example.com:
If the domain given is www.example.com it should 301 redirect to example.com because I do not want to have duplicate content that will create problems in search engines.
If the domain is anythingelse.example.com it should silently redirect to example.com so that software can pick up what subdomain was requested and act accordingly.
In addition, any specification after the domain name that does not refer to an actual file or directory should be redirected to index.php (again the software will figure out what it all meant). So anything.example.com/some/search/engine/friendly/specification should redirect to example.com/index.php.
I can get parts of this to work, but have yet to achieve the whole thing. Any offers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这些规则:
Try these rules: