重写问题,/controller/action 而不是/folder/file.php
我有一个调用 KCFinder 的脚本。
window.open('/kcfinder/browse.php?type=files', ...);
它必须打开一个包含 KCFinder 的窗口,但是当我单击“浏览器”按钮时,它会生成错误:
“未捕获的异常 'Zend_Controller_Dispatcher_Exception' 带有消息“无效控制器” 指定 (kcfinder)' 中 /home/vhosts/vonline_admin/library/Zend/Controller/Dispatcher/Standard.php 在第 248 行”
我理解这个错误。它说控制器“未找到 kcfinder”,但 kcfinder 不需要控制器,它只是一个路径。奇怪的是,我在本地成功运行该网站,但当我将其放在托管上时, 我认为它
与重写问题或路由有关,但我不知道如何修复它
:/usr/local/apache2/conf/vhosts/something_admin.conf。
服务器名称 admin.something.com
ServerAdmin [电子邮件受保护] DocumentRoot /home/vhosts/something_admin/www SetEnv APPLICATION_ENV 开发 跟踪启用关闭 <目录/home/vhosts/something_admin/www> 选项 -索引 -包括 -ExecCGI -FollowSymLinks 允许覆盖无 重写引擎开启 RewriteRule !\.(js|ico|gif|jpg|png|css|swf|txt|htm|html|xml)$
/index.php
.htaccess 在 www:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]
I have a script of calling KCFinder.
window.open('/kcfinder/browse.php?type=files', ...);
it must open a window which contains KCFinder, but when I click the "Browser" button, it generatates error:
"Uncaught exception
'Zend_Controller_Dispatcher_Exception'
with message 'Invalid controller
specified (kcfinder)' in
/home/vhosts/vonline_admin/library/Zend/Controller/Dispatcher/Standard.php
on line 248"
I understand this error. It says that controller "kcfinder not found", but kcfinder doesn't require a controller, it's simply a path. Strangely, I run the website successfully in local but when I put it on hosting, it failed.
I think it is related to rewrite problem or routing but I don't know how to fix it.
Vhost: /usr/local/apache2/conf/vhosts/something_admin.conf
ServerName admin.something.com
ServerAdmin [email protected] DocumentRoot /home/vhosts/something_admin/www SetEnv APPLICATION_ENV development TraceEnable off <Directory /home/vhosts/something_admin/www> Options -Indexes -Includes -ExecCGI -FollowSymLinks AllowOverride None </Directory> RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css|swf|txt|htm|html|xml)$
/index.php
.htaccess in www:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能看到你的 htaccess 文件和我的 htaccess 文件之间的唯一区别在于 RewriteRules;我有一个星号:
The only difference I can see between your htaccess file and mine is in the RewriteRules; I have an asterisk: