将域指向我网站中的页面

发布于 2024-09-26 12:03:48 字数 392 浏览 1 评论 0原文

我有一个目录网站,其中每个城市都有子页面。比如说 纽约将有一个地址 www.directory.com/newyork,洛杉矶将有 www.directory.com/la

所以我想将域名 newyorkdirectory.com 指向 www.directory.com/newyork 因此,对于每个子部分...我有哪些选项...我可以在我的代码中执行此操作吗?有什么方法可以从 php 检测域并相应地加载内容吗?

如果我将所有域都指向该站点,我可以检测传入域并将它们引用到页面吗?我对此完全不知道。

澄清: 当人们通过 newyorkdirectory.com 访问该网站时,该页面 www.directory.com/newyork/malls 应通过 newyorkdirectory.com/malls 访问

I'm having a directory website with sub-pages for each city. Like for example
Newyork will have an address www.directory.com/newyork, LA will have www.directory.com/la

so i want to point the the domain newyorkdirectory.com to www.directory.com/newyork
and so for each sub sections... what are the options I have.. can I do this in my code? Is there any way to detect the domain from php and load the content accordingly?

If all i point all the domain's to the site can i detect the incoming domain and refer them to a page? I totally have no idea on this.

Clarification:
when people goto the site through newyorkdirectory.com the page
www.directory.com/newyork/malls should be accessed through newyorkdirectory.com/malls

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

窝囊感情。 2024-10-03 12:03:48

所以我想指向域名
newyorkdirectory.com 至
www.directory.com/newyork

您的意思是您希望网站上所有现有的“newyorkdirectory.com”链接都指向“www.directory.com/newyork”?或者当人们尝试访问“newyorkdirectory.com”时,您想指向“www.directory.com/newyork”?

如果您不拥有域“newyorkdirectory.com”,则第二种情况是不可能的,否则我认为您可以使用 Apache .htaccess 重新路由。

so i want to point the the domain
newyorkdirectory.com to
www.directory.com/newyork

You mean you want all existing "newyorkdirectory.com" links of your website to point to "www.directory.com/newyork"? Or you want to point to "www.directory.com/newyork" when people try to go to "newyorkdirectory.com"?

Second case is impossible if you do not possess domain "newyorkdirectory.com", else you can reroute using Apache .htaccess I think.

假装爱人 2024-10-03 12:03:48

您可以控制网络服务器吗?您只需将 newyork 文件夹设为 newyorkdirectory.com 域的根目录即可。如果它来自其他地方,您总是可以在该域上放置一个快速重定向脚本...即index.php:

<?php
header('Location: http://www.directory.com/newyork');
exit();
?>

Are you in control of the web-server? You can simply make the newyork folder the root for the newyorkdirectory.com domain. If it's coming from somewhere else, you could always drop a quick re-direct script on that domain... i.e. index.php:

<?php
header('Location: http://www.directory.com/newyork');
exit();
?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文