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

时间:2021-10-24 11:18:25

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 Hosting,Linux,Apache

1 个解决方案

#1


0  

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]

#1


0  

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]