Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 如何使用htaccess重定向到子域_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache 如何使用htaccess重定向到子域

Apache 如何使用htaccess重定向到子域,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我想使用.htaccess在网站上使用子域,但对.htaccess几乎没有经验。我的.htaccess文件中有以下内容,但不起作用: 这其中大部分是我从别人的建议中抄来的。我想要的是进入Family.mysitehere.org并让它进入mysitehere.org/Family 谁能告诉我这个代码有什么问题吗?非常感谢 DirectoryIndex index.html index.htm index.php AddHandler cgi-script .cgi .pl Options +

我想使用
.htaccess
在网站上使用子域,但对.htaccess几乎没有经验。我的
.htaccess
文件中有以下内容,但不起作用: 这其中大部分是我从别人的建议中抄来的。我想要的是进入Family.mysitehere.org并让它进入mysitehere.org/Family 谁能告诉我这个代码有什么问题吗?非常感谢

DirectoryIndex index.html index.htm index.php

AddHandler cgi-script .cgi .pl

Options +FollowSymLinks

RewriteEngine On

RewriteBase /

RewriteRule wmail$ http://webmail.x7hosting.com [R,NC]

RewriteCond %{HTTP_HOST} \.

RewriteCond %{HTTP_HOST} !^www\. [NC]

RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.mysitehere\.org(:80)?<>/([^/]*) [NC]

RewriteCond %1<>%3 !^(.*)<>\1$ [NC]

RewriteRule ^(.*) /%1/$1 [L]

ErrorDocument 404 /404missing.php
DirectoryIndex.html index.htm index.php
AddHandler cgi script.cgi.pl
选项+FollowSymLinks
重新启动发动机
重写基/
重写规则wmail$http://webmail.x7hosting.com [R,NC]
重写cond%{HTTP_HOST}\。
重写cond%{HTTP_HOST}^www\。[北卡罗来纳州]
重写cond%{HTTP\u HOST}%{REQUEST\u URI}^([^.]+)\.mysitehere\.org(:80)?/([^/]*)[NC]
重写秒%1%3^(.*)\1$[NC]
重写规则^(.*)/%1/$1[L]
ErrorDocument 404/404missing.php
我想要的是进入Family.mysitehere.org并让它进入mysitehere.org/Family

文档\u ROOT/.htaccess
文件中使用此代码:

RewriteEngine On

#RewriteCond %{HTTP_HOST} ^(Family)\.(mysitehere\.org)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L,NE]