Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
Php 将别名重定向到特定文件夹_Php_.htaccess_Dns - Fatal编程技术网

Php 将别名重定向到特定文件夹

Php 将别名重定向到特定文件夹,php,.htaccess,dns,Php,.htaccess,Dns,我需要将特定域别名重定向到主域中的特定文件夹。好吧,我只有一台主机有主域数据,我需要这样做: http://a.com/ -> redirect automatically to: http://a.com/project-a -> currently done http://a.com/project-a http://a.com/project-b -> no redirect, it is the final folder -> currently done #

我需要将特定域别名重定向到主域中的特定文件夹。好吧,我只有一台主机有主域数据,我需要这样做:

http://a.com/
-> redirect automatically to: http://a.com/project-a
-> currently done

http://a.com/project-a
http://a.com/project-b
-> no redirect, it is the final folder
-> currently done

### HERE: ###
http://b.com/
-> redirect transparently to: http://a.com/project-b
-> I need do that!
注意:
b.com/..
需要透明地重定向到
a.com/project-b/..
。例如:

http://b.com/ => http://a.com/project-b/
http://b.com/news => http://a.com/project-b/news
我需要知道如何在.htaccess文件中执行此操作。域别名正常,但当前
a.com
b.com
都重定向到
a.com
主机(这是正确的),但
b.com
需要在特定文件夹中工作

我不知道这是否是一个问题,但是
/project-b
文件夹不存在,它只是一个
mod_rewrite
index.php


我不想通过301重定向,我需要透明地执行所有操作(用户会认为他们在
b.com
hosting中)。

403不是重定向。不存在4xx代码。重定向总是3xx。对不起!你是对的!我是说301代码D