【发布时间】:2016-08-15 21:27:53
【问题描述】:
我正在尝试使用 quercus 在 tomcat 上运行 codeigniter。
我在 webapps/ROOT 中安装了 quercus,然后在 webapps/ROOT/appname 中安装了 codeigniter。
我可以在 webapps/ROOT/appname 中访问 index.php,但是如果我尝试访问 ROOT/appname/index.php/login/login,就会出现 404 错误。我什至无法访问 ROOT/appname/welcome。
如何解决这个 404 错误?
我正在使用 codeigniter 2.x。
我使用 urlrewriterfilter 来替换 htaccess。但它似乎不起作用。 以下是我的 urlrewrite.xml。
<urlrewrite>
<rule>
<name>Generic Pretty URLs Pass-through</name>
<condition type="request-uri" operator="notequal">^/(robots.txt|osd.xml|flex2gateway|cfide|cfformgateway|railo-context|admin-context|files|images|jrunscripts|javascripts|miscellaneous|stylesheets)</condition>
<condition type="request-uri" operator="notequal">\.(bmp|gif|jpe?g|png|css|js|txt|xls|ico|swf|woff|ttf|otf)$</condition>
<condition type="request-filename" operator="notdir"/>
<condition type="request-filename" operator="notfile"/>
<from>(.*)</from>
<to type="passthrough" last="true">index.php/$1</to>
</rule>
</urlrewrite>
【问题讨论】:
-
Codeigniter 的“漂亮 URL”路由需要一个 .htaccess 文件,其中包含 Apache HTTPD 中的一些重写规则。 Quercus 不支持这个 .htaccess 文件。你需要这样的东西:stackoverflow.com/questions/5920870/…
-
谢谢塞尔吉乌。不幸的是,参考文献并没有帮助。我还发现了 urlrewriterfilter,但找不到将 codeigniter 的 htaccess 更改为 urlrewrite.xml 的示例
-
Codeigniter 的 htaccess 是所有实现前端控制器模式的框架都使用的。您应该可以使用将公用文件夹中现有文件以外的任何内容重定向到 index.php 的任何 urlrewrite.XML。
-
好像不行。我在上面附上了我的 urlrewrite.xml。
标签: java php codeigniter http-status-code-404 quercus