更改停放域的文档根目录?
我遇到了一个问题,即我的网络主机没有提供插件域。
我目前有一个指向我的名称服务器的域名。
我进入 cPanel 添加一个指向子目录的插件域,但 cPanel 中可用的只是将域停放在文档根目录“public_html/”处。
因此来自停放域的流量会得到错误的内容,这显然不好。
我感觉这是不可能的,但是我可以将停放域文档根从 'public_html/' 更改为 'public_html/sub-directory' 吗?
或者我可以编辑 .htaccess 文件以将流量从停放域重定向到子目录吗?
基本上我想要这个地址; www.parked-domain.com/
显示该子目录的内容; www.first-domain.com/parked-directory
我希望这是可能的,否则我需要寻找新的网络主机。
问候,
迪恩。
I have run into a problem which is that my web host doesn't appear offer addon domains.
I currently have a domain name pointing to my name servers.
I went into cPanel to add an addon domain that points to a sub-directory, but all that is available in cPanel is to park domain at the document root which is 'public_html/'.
So traffic coming from the parked domain would get the wrong content, which is obviously not good.
I get the feeling that this isn't possible, but can I change the parked domain document root from 'public_html/' to 'public_html/sub-directory' ?
Or perhaps can I edit the .htaccess file to redirect traffic from the parked domain to the sub-directory?
Basically I want this address; www.parked-domain.com/
To show the content of this sub-directory; www.first-domain.com/parked-directory
I hope this is possible otherwise I need to look at a new web host.
Regards,
Dean.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将以下内容添加到您的 .htaccess 文件中:
Add the following to your .htaccess file:
虽然令人皱眉,但可以使用 mod_rewrite 动态设置您的停放域子主机。
以下是通过 mod_rewrite 使用动态格式进行多主机的 .htaccess 示例,该格式需要停放域名 = 子文件夹名称,并涵盖您网站上被重定向或忽略的其他停放域。
While frowned upon, it is possible to dynamically set up your parked domain sub-hosts using mod_rewrite.
Here's a .htaccess sample for multihosting via mod_rewrite using a dynamic format that requires parked-domain-name = sub-folder-name, and covers other parked domains on your site being redirected or ignored.
不要使用“停放域”,而是使用插件域 - 这里只是 public_html/子目录的根目录,您要在其中指向新的“停放”域...
instead of using "parked domain", use the addon domain - and here just the root directory to public_html/sub-directory where you want to point your new "parked" domain...