简体   繁体   English

放置htaccess文件以供所有子域重定向

[英]Place htaccess file for all subdomains to redirect

I have configured my server to accept any subdomain for 我已将服务器配置为接受以下任何子域

pinnaclerealestatesystems.com

(Its something like a virtual host). (类似于虚拟主机)。 Its not pointing to any folder/path. 它没有指向任何文件夹/路径。

I've written the .htaccess code to redirect all the domains.. Now, i just want to know, where to place .htaccess file in my hosting. 我已经编写了.htaccess代码以重定向所有域。.现在,我只想知道将.htaccess文件放置在主机中的位置。

You can try a sample subdomain to get a batter idea 您可以尝试一个子域名示例来了解

http://abc.pinnaclerealestatesystems.com

I'm using Godaddy Hosting, Linux, Apache 我正在使用Godaddy托管,Linux,Apache

You can place this rule your DocumentRoot/.htaccess : 您可以将此规则放在DocumentRoot/.htaccess

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+)\.pinnaclerealestatesystems\.com$ [NC]
RewriteRule ^(.*)$ /%1/$1 [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM