子域指向带有 mod 重写的子文件夹
嗨,我对 PHP 很陌生......并且需要尽快做一些事情......
我在“clients”目录中有一些客户端,如下所示...... “http://domain.com/clients/client0001/fluids/。 .."
我希望这个 URL 像这样显示在地址栏中。
"http://client0001.domain.com/fluids/..."< /strong>
在 .htaccess 的帮助下。任何帮助将不胜感激...
谢谢
Hi I'm quite new to PHP... And need something to do as fast as I can..
I have some clients within the "clients" directory like here...
"http://domain.com/clients/client0001/fluids/..."
I want this URL to be shown in the address bar like this.
"http://client0001.domain.com/fluids/..."
with the help of .htaccess. Any help will be appreciated ...
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 mod_rewrite 来重写此类 URL:
但是您的网络服务器需要进行配置,以便它接受此类主机名并将请求发送到正确的虚拟主机。
You can use mod_rewrite to rewrite such URLs:
But your webserver needs to be configured so that it accepts such host names and sends the requests to the proper virtual host.
我以前用过这个,正如 Gumbo 发布的那样。
我遇到的唯一问题是您无法使用进一步的重写规则 - 因此,如果您在子域上提供服务的网站使用 url 重写,您必须将其设为自己的虚拟主机。
I've used this before as posted by Gumbo.
Only issue I've had with it is that you can't then use further rewrite rules - so if the site you are serving on the subdomain uses url rewriting, you have to make it its own virtual host.