![](/img/trans.png)
[英]Problem with url routing in Zend Framework, needs index.php?
[英]PHP Zend Framework Application needs index.php in URL to operate on CENTOS
僅當我在URL末尾添加“ index.php”時,該應用程序才能工作。 我正在使用CENTOS。 如何刪除它,因此例如可以轉到http://server/admin/dashboard
而不是http://server/admin/index.php/dashboard
。 這是我的htaccess文件:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
謝謝。
這是我使用的,如果我沒記錯的話,我是從Rob Allen那里得到的:
//index.php
<?php
$_SERVER["REQUEST_URI"] = str_replace('index.php', '', $_SERVER["REQUEST_URI"]);
//rest of index.php
還有其他方法可以做到,這只是我選擇的一種。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.