重命名根目录中的index.php

发布于 2025-01-08 15:45:19 字数 389 浏览 0 评论 0原文

我的根目录上有两个应用程序,我试图将它们都保留在那里,但它们都有 index.php 文件作为目录索引。有没有一种方法可以重命名或更改其中一个,这样它们就不会重叠。或者让它们两者共存。

这些是我试图保留在同一目录下的应用程序。

应用程序 # 1 https://github.com/wolfcms/wolfcms

应用程序 # 2 http://opencart.googlecode.com/svn/trunk/upload/

I have two applications on my root directory and im trying to keep them both there but they both have index.php files as a directory index. Is there a way to rename or change one of them so they dont overlap. Or have them both coexist together.

These are the apps im trying to keep under the same directory.

app # 1 https://github.com/wolfcms/wolfcms

app # 2 http://opencart.googlecode.com/svn/trunk/upload/

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

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

发布评论

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

评论(1

晨曦÷微暖 2025-01-15 15:45:19

如果不对这两个应用程序进行修改,您就无法做到这一点。为什么不呢?

这两个应用程序都使用 htaccess 重写将请求映射到

GET /thisPath/SomeFutherContext

执行 DOCROOT/thisPath/.htaccess ,该请求重写请求以进行内部重定向到 DOCROOT/thisPath/index.php 然后充当中央交换所来处理 SomeFutherContext

为了使两者位于同一个 thispath 中,您需要集成它们的 .htaccess 文件,有两个交换所条目,例如indexwolf.php 和indexshop.php,以及能够在 .htaccess 中通过一些正则表达式来解码 SomeFutherContext ,以便您可以分派到正确的位置。

但是,将它们设置为一个基于 http://yourdomain/wolfcms/,另一个基于 http://yourdomain/shop/ code> 很简单,只需按照两者的安装指南并在 DOCROOT/thisPath/shop/ 中安装 opencart 并在其 .htaccess 文件中更改 RewriteBase到RewriteBase /shop/ 按照其指示。

顺便说一句,

  1. 如果您在共享服务上运行,则 php_flag 指令将不起作用。您需要配置您自己的 php.ini
  2. 有人应该告诉 WolfCMS 开发人员位置标头应符合 RFC 1945 ;-)

附录

如果您的托管提供商支持通配符子域映射器(默认情况下大多数都支持,因此请检查您的 HSP 常见问题解答或在这里发回您的托管提供商是谁),然后您可以使用子域(例如 wolfcms.yourdomain)将其与您的商店分开,方法是将以下内容添加到您的文档根目录.htaccess 紧接在 RewriteBase / 之后:

RewriteCond %{HTTP_HOST} =wolfcms.yourdomain
RewriteRule ^.*          wolf/$0              [L]

然后将 WolfCMS 存储在 Docroot/wolf 中,其 .htaccess 位于 DOCROOT/wolf 中/.htaccessRewriteBase / (不是 RewriteBase /wolf)。

You can't without modification to both applications. Why not?

Both application use htaccess rewrite to map a request to, say,

GET /thisPath/SomeFutherContext

to execute DOCROOT/thisPath/.htaccess which rewrites the request to do an internal redirect to DOCROOT/thisPath/index.php which then acts as a central clearing house to process SomeFutherContext.

For the two to sit in the same thispath, you would need to integrate their .htaccess files, have two clearing house entries, say indexwolf.php and indexshop.php, and be able in the .htaccess through some regexp to decode SomeFutherContext so that you can dispatch to the right one.

However, setting them up so that one is based on http://yourdomain/wolfcms/ and the other on http://yourdomain/shop/ is trivial, just follow the install guide for both and install opencart in DOCROOT/thisPath/shop/ changing RewriteBase in its .htaccess file to RewriteBase /shop/ as it instructs.

BTW,

  1. If you are running on a shared service the php_flag directive won't work. You will need to configure your own php.ini
  2. Someone should tell the WolfCMS developers that location headers should conform to RFC 1945 ;-)

Addendum

If your hosting provider supports a wildcard subdomain mapper (most do by default, so either check your HSPs FAQs or post back here who your hosting provider is), then you can use subdomain e.g. wolfcms.yourdomain to separate it from your shop, by adding the following to your docroot .htaccess immediately after the RewriteBase /:

RewriteCond %{HTTP_HOST} =wolfcms.yourdomain
RewriteRule ^.*          wolf/$0              [L]

You then store WolfCMS in Docroot/wolf, and its .htaccess is in DOCROOT/wolf/.htaccess with a RewriteBase / (not RewriteBase /wolf).

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