1

如果用户请求现有的 php 代码,我将其放在根目录中:

  • domain.com/images/pic1.jpg
  • domain.com/anyphp.php
  • domain.com/someapp/somecode.php
  • domain.com/anything.someExt
  • ETC

什么都不做,就这样吧,他们工作得很好。

但如果他只是输入 domain.com -> 将他发送到 domain.com/myNewApp/index.php,这是我很酷的新应用程序。不要将 URL 重写为 domain.com/index.php,因为它适用于我现有的应用程序。

我希望答案可能非常简单,但我只是放弃尝试

4

2 回答 2

0

您有权访问 Apache conf 文件吗?如果是这样:

RewriteEngine  on
RedirectMatch ^/(.*)$ http://example.com/myNewApp/index.php

应该管用。

编辑:这种重写不起作用。我从未使用过正则表达式捕获。我误读了你想要的。看起来您找到了答案,但是如果您将正则表达式更改为:

RewriteEngine  on
RedirectMatch ^/$ http://example.com/myNewApp/index.php

查看此页面以获得更多可重写的优点: http ://httpd.apache.org/docs/current/rewrite/remapping.html

于 2014-08-07T00:37:58.613 回答
0

DirectoryIndex oxwall/index.php

简单但有效

于 2014-08-11T04:21:02.337 回答