3

假设我有 domain.com 和其他五个子域。

子域存储在与 domain.com 不同的文件夹中

在 domain.com 中,我将拥有 3 个文件夹,当我在其他子域中时,我需要访问这些文件夹,我将访问 php、css、图像、任何东西。

每个子域都需要有自己的 htaccess。

做到这一点的最佳方法是什么?我读过一些关于 open basedir 的文章,但我不确定这是否是最好的方法。也不知道它是如何工作的。

提前致谢

4

2 回答 2

5

if you don't want to go through the stress of editing .htaccess or you dont have shell access, then just use URL paths for resources like images e.g. "http://example.com/images/prev.png" for include files you can use absolute paths "/home/example/public_html/inc/test_subd.php"

于 2012-12-02T00:24:52.237 回答
1

如果它在不同的服务器上,您可以使用该.htaccess文件将请求代理到原始域(如果您启用了mod_rewritemod_proxy )。

RewriteRule ^images/(.*)$ http://www.example.com/images/$1 [P]

如果它们都在同一台服务器上:

  1. 使用符号链接(如果它在 Linux/Unix/OSX 上)创建指向其他图像文件夹的符号链接。从外壳使用ln -s /path/to/images /path/to/subdomain/images. 有关更多信息,请参见ln 的手册页。
  2. 如果您启用了mod_alias,您可以Alias /image /path/to/images在您的.htaccesshttpd.conf.
于 2011-06-18T01:43:34.617 回答