将域指向我网站中的页面
我有一个目录网站,其中每个城市都有子页面。比如说 纽约将有一个地址 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的意思是您希望网站上所有现有的“newyorkdirectory.com”链接都指向“www.directory.com/newyork”?或者当人们尝试访问“newyorkdirectory.com”时,您想指向“www.directory.com/newyork”?
如果您不拥有域“newyorkdirectory.com”,则第二种情况是不可能的,否则我认为您可以使用 Apache .htaccess 重新路由。
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.
您可以控制网络服务器吗?您只需将 newyork 文件夹设为 newyorkdirectory.com 域的根目录即可。如果它来自其他地方,您总是可以在该域上放置一个快速重定向脚本...即index.php:
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: