Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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_Dns - Fatal编程技术网

Apache .htaccess将一个域指向另一个域/目录

Apache .htaccess将一个域指向另一个域/目录,apache,.htaccess,dns,Apache,.htaccess,Dns,我需要修改.htaccess文件,以便覆盖我的域。 首先我告诉你我对.htaccess文件一无所知。 这个.htaccess文件中已经有很多东西了 我想要的是重定向我的 www.one-domain.com 到 我不想再改变什么了。只有one-domain.com开始显示second-domain.com/abc的内容 域的两个站点之间都有wordpress one-domain.com内容位于root/ second-domain.com内容位于root/direcoty 下面是my.hta

我需要修改.htaccess文件,以便覆盖我的域。 首先我告诉你我对.htaccess文件一无所知。 这个.htaccess文件中已经有很多东西了

我想要的是重定向我的

www.one-domain.com

我不想再改变什么了。只有one-domain.com开始显示second-domain.com/abc的内容

域的两个站点之间都有wordpress

one-domain.com内容位于
root/
second-domain.com内容位于
root/direcoty

下面是my.htaccess文件的内容,该文件已经存在

# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
#-FrontPage-
IndexIgnore.htaccess*/.??**~*#*/HEADER**/README**/\u vti*
命令拒绝,允许
全盘否定
通融
命令拒绝,允许
全盘否定
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

RewriteBase
行下方插入此代码:

RewriteCond %{HTTP_HOST} ^(www\.)?one-domain\.com$ [NC]
RewriteRule ^$ http://www.second-domain.com/abc [L,R=301]
还要注意,此块重复多次:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]

您只需在.htaccess中使用此块一次

将此代码插入
RewriteBase
行下方:

RewriteCond %{HTTP_HOST} ^(www\.)?one-domain\.com$ [NC]
RewriteRule ^$ http://www.second-domain.com/abc [L,R=301]
还要注意,此块重复多次:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]

您只需在.htaccess中使用此块一次

只需
www.onedomain.com
www.second-domain.com/abc
www.onedomain.com/foo
www.second-domain.com/abc/foo
?这将是一个外部重定向,并将更改浏览器中的URL,可以吗?只需将www.onedomain.com更改为www.second-domain.com/abc即可。然而,我不希望外部重定向,但这仍然很好,对我来说很有用。也就是
www.onedomain.com
www.second-domain.com/abc
或者
www.onedomain.com/foo
www.second-domain.com/abc/foo
?这将是一个外部重定向,并将更改浏览器中的URL,可以吗?只需将www.onedomain.com更改为www.second-domain.com/abc即可。然而,我不想外部重定向,但仍然会很好,将为我工作。