gpt4 book ai didi

.htaccess - htaccess : Display homepage on wrongly typed subdomain

转载 作者:行者123 更新时间:2023-12-01 05:27:07 25 4
gpt4 key购买 nike

当用户输入错误的子域时,我需要显示自定义 url 源。

例如,如果用户输入 hames.domain.com而不是 games.domain.com , hames.domain.com应该显示 domain.com 索引的 html 源.

P.s:我不想要 iframe 或重定向,它需要显示主域的索引。

我试过下面的代码

RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteRule ^%1/(.*)$ /$1 [L,NC]

最佳答案

嗯,我不是 htaccess 的专家,但如果用户输入错误的子域,他将收到 404 错误。因此,如果他收到,请将他重定向到您的域。

错误文档 404 domain.com

关于.htaccess - htaccess : Display homepage on wrongly typed subdomain,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13309172/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com