Alias、mod_rewrite或其他用于共享php脚本的内容


Alias, mod_rewrite or something else for shared php scripts?

我有很多域名都指向同一台服务器,我正在寻找一种方法,将每个域名中的一组脚本作为一种共享资源访问到一个位置。

例如

http://abcdeals.com/shared-resource/
http://defdeals.com/shared-resource/
http://hijdeals.com/shared-resource/

所有文件都使用/home/zdeals/public_html/shared-resource/中的相同文件


完整详细信息:

"共享资源"文件位于以下服务器路径中

/home/zdeals/public_html/shared-resource/

多个域名,例如(abcdeals.com、defdeals.com和hijdeals.com)位于以下服务器路径中

/home/abcdeals/public_html/
/home/defdeals/public_html/
/home/hijdeals/public_html/

理想情况下,我希望能够访问共享资源文件,而无需通过访问重定向用户

http://abcdeals.com/shared-resource/
http://defdeals.com/shared-resource/
http://hijdeals.com/shared-resource/

我一直在看别名和mod_rewrite,但没有用。我在/home/abcdeals/public_html/.htaccess 中尝试过一些东西

AliasMatch ^/shared-resource(.*) /home/zdeals/public_html/shared-resource$1

RewriteRule ^shared-resource/(.*) home/zdeals/public_html/shared-resource/$1 [L]

以及更多类似的

访问http://abcdeals.com/shared-resource/ 时,我收到500内部服务器错误或404未找到错误

如果有帮助的话,我还可以访问httpd.conf文件。

现有的.htaccess文件如下

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
#RewriteBase /
RewriteRule . index.php [PT]
RewriteRule ^(system/(classes|locale|schema|$)) index.php [PT]

我将永远感激在这方面的任何帮助。

您可以为此使用符号链接。在linux中,您可以通过以下方式实现:

ln -s /home/zdeals/public_html/shared-resource/ /home/abcdeals/public_html/shared-resource/

它创建一个符号链接/home/abcdeals/public_html/共享资源/-->/home/zdeals/ppublic_html/分享资源/