DNS / .htaccess文件重定向子域特定的文件夹 [英] DNS/.htaccess files to redirect subdomain to specific folder

查看:113
本文介绍了DNS / .htaccess文件重定向子域特定的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的子域名重定向到一个flder。我想我在这里另一篇文章中的.htaccess code。是这样的:

I'm trying to redirect my subdomain to a flder. I think I have the .htaccess code from another post here. Something like:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^clients\.example\.com$
RewriteRule ^ http://example.com/clients/root/app%{REQUEST_URI} [L,P]

什么是DNS的设置应该怎么设置为客户。子域与htaccess的扎入。

What DNS settings should I set up for the clients. subdomain to tie it in with the .htaccess.

推荐答案

您需要创建一个CNAME指向 clients.example.com 到同一台服务器 example.com 。然后,你需要确保你的网络服务器是安装程序服务于 clients.example.com 在同根 example.com

You need to create a CNAME to point clients.example.com to the same server as example.com. Then you need to make sure your webserver is setup to serve the clients.example.com in the same root as example.com.

,你可以简单地设置 clients.example.com 的虚拟主机指向 /用户/根/ APP / 文件夹代替。有一个叫指令的DocumentRoot ,你会使用指向一个虚拟主机到它的根文件夹是。

Of, you can simply setup clients.example.com's vhost to point to the /clients/root/app/ folder instead. There's a directive called DocumentRoot that you'd use to point a vhost to a where it's root folder is.

在第一个实例,其中两个主要的域和子域指向同一个根,则不需要使用 P 标志的情况下:

In the case of the first instance, where both the main domain and subdomain point to the same root, you don't need to use the P flag:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^clients\.example\.com$
RewriteRule ^ /clients/root/app%{REQUEST_URI} [L]

足够好,绕开需要经过的mod_proxy。

Is good enough and circumvents the need to go through mod_proxy.

这篇关于DNS / .htaccess文件重定向子域特定的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆