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 保留域名访问权_Apache_.htaccess_Redirect_Mod Rewrite - Fatal编程技术网

Apache 保留域名访问权

Apache 保留域名访问权,apache,.htaccess,redirect,mod-rewrite,Apache,.htaccess,Redirect,Mod Rewrite,我有个小问题。我有一个主机与piensasolutions和两个域。第一个域控制主机,第二个域使用域停车 让a.com作为第一个域,b.com作为第二个域 我的b.com域停车允许我从b.com重定向到a.com/folder,(其中folder包含我要指向b.com的网页) 问题是我想显示b.comURL而不是a.com/文件夹URL,我不确定问题是否来自piensasolutions,因为我尝试了几个.htaccess文件,但无法更改web浏览器的URL。这是我最后一次测试,它假设保持原始U

我有个小问题。我有一个主机与piensasolutions和两个域。第一个域控制主机,第二个域使用域停车

a.com
作为第一个域,
b.com
作为第二个域

我的
b.com
域停车允许我从
b.com
重定向到
a.com/folder
,(其中folder包含我要指向
b.com
的网页)

问题是我想显示
b.com
URL而不是
a.com/文件夹
URL,我不确定问题是否来自piensasolutions,因为我尝试了几个.htaccess文件,但无法更改web浏览器的URL。这是我最后一次测试,它假设保持原始URL

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www.)?a.com/folder/$ 
RewriteRule ^(.*)$ /a.com/folder/$1 [L]

RewriteCond %{HTTP_HOST} ^(www.)?b.com$
RewriteRule ^(.*)$ /b.com/$1 [L]
有关更多信息,我将.htaccess文件放在
a.com/文件夹中
。我不确定Piensa解决方案的重定向

如果你能帮助我,我将非常感激,如果你能抽出几分钟的时间,即使你还没有找到anwser


谢谢大家!

我认为最好的方法是使用可用的站点。 首先,

$ vi /etc/host
并复制下一行:

127.0.0.1   a
127.0.0.1   b
然后,创建两个新站点:

$ touch /etc/apache2/sites-avaiable/a
$ touch /etc/apache2/sites-avaiable/b
然后编辑它们

$ vi /etc/apache2/sites-avaiables/a


<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName a
DocumentRoot /your_path_to_server/a/folder
    <Directory /your_path_to_server/a/folder/>
                    Options FollowSymLinks
                    AllowOverride All          
                    Require all granted
    </Directory>
</VirtualHost>
$vi/etc/apache2/sites availables/a
服务器管理员webmaster@localhost
服务器名a
DocumentRoot/您的\u路径\u到\u服务器/a/文件夹
选项如下符号链接
允许超越所有
要求所有授权

$vi/etc/apache2/sites availables/b
服务器管理员webmaster@localhost
服务器名b
DocumentRoot/您的\u路径\u到\u服务器/b
选项如下符号链接
允许超越所有
要求所有授权

就这些。这应该行。

谢谢你的想法,但我无法访问服务器,我只能修改主机文件
$ vi /etc/apache2/sites-avaiables/b


<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName b
DocumentRoot /your_path_to_server/b
    <Directory /your_path_to_server/b/>
                    Options FollowSymLinks
                    AllowOverride All          
                    Require all granted
    </Directory>
</VirtualHost>