协调多个默认页面的首选方法是什么?

发布于 2024-09-29 10:29:47 字数 1012 浏览 1 评论 0原文

问题是:我们有一个网站系列(大约 8 个),每个网站托管在该系列每个成员共用的单个域的不同子域上。例如,

ecommerce.my_domain.com
forums.my_domain.com
signup.my_domain.com

由于各种原因,每个子域都与其他子域分开管理,即不同的服务器,相对于其他子域而言,几乎每个开发决策都完全自主,包括 Web 框架的选择,例如., 两个是 Django,一个是 Zend,等等(尽管都运行 Apache 2.2)。我们想要解决这个问题,总有一天我们会的,只是不会很快。

这种结构的一个直接后果是我们有多个默认页面名称。通过“默认页面”,我指的是当子域上没有给出页面时服务器默认的页面 - 有时是“index.html”,有时是“index.php”等(我知道它们是什么,事实上,有多个页面是一个问题。)

(默认页面是当域上未指定页面时服务器默认的网页。例如,如果您输入时提供“index.html”页面“www.my_domain.com”、“index.html”是默认页面。)

这会导致一个问题:我们的分析代码 (javascript) 将计算 subdomain1.my_domain.com subdomain1 的页面浏览量.my_domain.com/index.html 作为两个单独的页面,除非指定了正确的默认页面。就其本身而言,这可能会导致基本页面视图测量中出现两倍的错误。此外,分析系统(Google Analytics)仅允许指定单个默认页面。

经过研究后,似乎一种方法是在服务器(Apache 2.2)上:(i)创建一个 CGI 目录而不使用 ScriptAlias; (ii) 当仅请求目录时,使用 DirectoryIndex 指定默认文档。

我想这也可以在支持每个子域属性的 Web 框架内完成,尽管考虑到我们有多个不同的框架,该选项肯定不太有吸引力。

我将感谢社区对首选方式的看法。

强文字*强文字*

Here's the problem: we have a family (approx. 8) of websites, each hosted on a different subdomain of a single domain common to every member of the family. E.g.,

ecommerce.my_domain.com
forums.my_domain.com
signup.my_domain.com

For various reasons, each subdomain is administered separately from the others--i.e., different servers, complete autonomously with respect to the others regarding nearly every development decision, including choice of web framework--for instance., two are Django, one is Zend, and so on (though all run Apache 2.2). We want to fix this, and someday we will, it just won't be anytime soon.

One direct consequence of this structure is that we have multiple Default page names. By 'Default Page' i'm referring to the page the server defaults to when no page on the subdomain is given--sometimes it's 'index.html', sometimes 'index.php', etc. (I know what they are, it's the fact that there are multiple pages that's a problem.)

(The Default page is the webpage to which your server defaults when no page on the domain is specified. For example, if the "index.html" page is served when you enter "www.my_domain.com", "index.html" is the Default page.)

Here's one problem it causes: our analytics code (javascript) will count page views to subdomain1.my_domain.com and subdomain1.my_domain.com/index.html as two separate pages, unless the correct default page is specified.By itself, this can cause a two-fold error in the basic page view measurement. In addition, the analytics system (Google Analytics) only allows a single Default Page to be specified.

After looking into this, it seems one way to do is at the Server (Apache 2.2) : (i) create a CGI directory without using ScriptAlias; (ii) use DirectoryIndex to specify a default document when only the directory is requested.

i suppose this can also be done within the Web Framework that supports each subdomain property, though given we have multiple different frameworks, that option is certainly less appealing.

I would be grateful for the Community's view on the preferred way to do this.

strong text*strong text*

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感受沵的脚步 2024-10-06 10:29:47

使用 .htaccess 文件来处理它怎么样?

只需添加类似于以下内容的行,并按照您希望其默认查找文件的顺序:

DirectoryIndex index.html default.php default.htm foo.html index.cgi

.htaccess 参考文档: http://httpd.apache.org/docs/current/howto/htaccess.html

What about using a .htaccess file to handle it?

Just add a line resembling the following with the order you want it to look for files to be your default:

DirectoryIndex index.html default.php default.htm foo.html index.cgi

.htaccess reference docs: http://httpd.apache.org/docs/current/howto/htaccess.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文