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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.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
使用.htaccess在两个域之间共享资源_.htaccess_Web Hosting - Fatal编程技术网

使用.htaccess在两个域之间共享资源

使用.htaccess在两个域之间共享资源,.htaccess,web-hosting,.htaccess,Web Hosting,我有两个不同的领域: www.domain1.com,指向文件夹www/domain1 和 www.domain2.com,指向文件夹www/domain2 我想将公共资源(php文件、图像等)共享到第三个文件夹www/ressources中 例如,php欢迎页面对于这两个域是相同的(只是使用使它们不同的特定变量): 在.htaccess中,我为域1尝试了以下技巧: DirectoryIndex../resources/test.php?dir=domain1(然后test.php将加载位于ww

我有两个不同的领域: www.domain1.com,指向文件夹www/domain1 和 www.domain2.com,指向文件夹www/domain2

我想将公共资源(php文件、图像等)共享到第三个文件夹www/ressources中

例如,php欢迎页面对于这两个域是相同的(只是使用使它们不同的特定变量): 在.htaccess中,我为域1尝试了以下技巧:

DirectoryIndex../resources/test.php?dir=domain1(然后test.php将加载位于www/domain1/var.php中的特定var)

和域2 DirectoryIndex../resources/test.php?dir=domain2(然后test.php将加载位于www/domain2/var.php中的特定var)

这不起作用(得到一个错误的请求400),我想是因为htaccess正在遍历域的根目录


解决方案是什么,因为我使用的是共享主机解决方案(OVH),只能修改.htaccess文件(我没有访问底层操作系统的权限)

由于您没有访问服务器或虚拟主机配置的权限,使用Alias指令的主要方法将不起作用。 根据您的要求,您可以使用重定向或重定向匹配算法,该算法可在.htaccess文件中进行配置。

由于您没有访问服务器或虚拟主机配置的权限,使用Alias指令的主要方法将不起作用。 根据您的要求,您可以使用重定向或重定向匹配算法,该算法可在.htaccess文件中进行配置。