[英].htaccess Redirect domain subdomain to sub directory
We'd like to redirect a subdomain to a subdirectory: 我们想将子域重定向到子目录:
customerservice.example.com to example.com/customerservice. customerservice.example.com到example.com/customerservice。
How is this done in .htaccess file? .htaccess文件中该如何完成?
I assumed: 我以为:
Redirect 301 customerservice.example.com example.com/customerservice 重定向301 customerservice.example.com example.com/customerservice
Am i correct in my assumption? 我的假设正确吗?
Redirect does not take a full domain as first argument, you have to use /
: 重定向不将完整域作为第一个参数,您必须使用
/
:
Redirect 301 / http://example.com/customerservice
However if this domain is on the same root of another domain and you need to match the domain name you will have to use something like this: 但是,如果此域位于另一个域的同一根上,并且您需要匹配域名,则将必须使用以下内容:
RewriteCond %{HTTP_HOST} ^customerservice\.example\.com$
RewriteRule ^(.*)$ http://example.com/customerservice/$1 [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.