我正在建立一个域名管理网站,我想转发的域名,我有一个“包罗万象”类型的主域,其中有联系信息等,但我希望人们只看到域名的网址是出售。我的主站点有一个像example.com/domain/_domain_这样的_domain_结构,其中url是要出售的实际域名。
例如,转到
example-for-sale.com将显示来自
example-main.com/domain/example-for-sale但是访问者只能在地址栏中看到原始域
example-for-sale.com更复杂的是,有许多example-for-sale域名,所以动态的方法会比为我出售的每个域名编写一个重定向更可取。
现在我使用PHP重定向用户,但这根本不能掩盖域名:
$domain_this = $_SERVER['HTTP_HOST']; // I also strip .com/.net/etc from here
$domain_that = "http://example-main.com/domain/";
header( 'Location: '. $domain_that . $domain_this );我已经研究了.htaccess mod_rewrite,但我还没有找到一种方法来将原始域作为参数发送到新的域,同时保持新的域被屏蔽。
这有可能吗?我可以使用PHP,.htaccess,或者我忘记的类似的东西。我想避免使用框架,因为它们看起来不专业。
发布于 2014-11-19 07:11:01
根据给出的信息,您可以通过以下方式实现这一点:
// Do your TLD stripping, whatever you're doing now likely works fine.
$domain_this = $_SERVER['HTTP_HOST'];
// Get the path to the file you're wanting to show the user. Keep security in mind here.
$page = __DIR__ . '/domain/' . $domain_this;
// Don't redirect, just include the contact page
include $page;请注意,这是假设页面是托管在同一个盒子上的那些出售的域名。我会要求更多的细节,但我还没有名气来发表评论。
https://stackoverflow.com/questions/27005117
复制相似问题