开发者

Access main domain files in Subdomain

开发者 https://www.devze.com 2023-03-13 23:46 出处:网络
Lets say i have domain.com and five other subdomains. The subdoma开发者_JS百科ins are stored in separate folders from domain.com

Lets say i have domain.com and five other subdomains.

The subdoma开发者_JS百科ins are stored in separate folders from domain.com

In domain.com i am going to have 3 folders that i need to access when i am in other subdomains, i'm going to be accesing php, css, images, any stuff.

Each subdomain needs to have their own htaccess.

What is the best approach to do this? i've read something about open basedir, but i'm not exactly sure if this is the best way to do it or not. And neither how it works.

Thanks in advance


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"


If it's on a different server, you could use the .htaccess file to proxy the requests to the original domain (if you have mod_rewrite and mod_proxy enabled).

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

If it's all on the same server:

  1. Use symlinks (if it's on Linux/Unix/OSX) to create symbolic links to the other images folders. From the shell use ln -s /path/to/images /path/to/subdomain/images. See the man page for ln for more information.
  2. If you have mod_alias enabled, you could use: Alias /image /path/to/images in your .htaccess or httpd.conf.
0

精彩评论

暂无评论...
验证码 换一张
取 消