【发布时间】:2013-11-08 16:13:36
【问题描述】:
我在虚拟 PC 中设置了一个 ubuntu 服务器。我将使用 codeigniter 框架创建的 php 应用程序放到 /var/www/sdbl 文件夹中。
现在我可以查看我的应用程序的索引页面。但所有的链接都坏了。
我将这些代码放入 .htaccess 文件中,它位于 /var/www/sdbl 文件夹中。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
同一应用程序在此链接上运行良好 http://3linksit.com/sdbl/
有人可以帮我解决这个问题吗? 提前致谢。
【问题讨论】:
-
你要去哪个链接不起作用? “不工作”是什么意思?服务器错误/404/什么都没有发生?
-
我刚刚发现...这个链接有效,但我想删除 index.php 的东西。 localhost/sdbl/index.php/new_userlocalhost/sdbl/new_user这个链接会跳转到404错误页面
-
你用什么来创建链接? codeigniter 原生的锚函数?
-
@Cameeob2003 - 没找到你
-
@Yasitha 我假设您正在通过
<a href="<?php echo base_url(''your/url'); ?>">Your Link</a>对链接进行硬编码,或者您正在使用<?php anchor('your/link/info'); ?>。这是一个正确的假设吗?无论哪种方式,您是否确保在 config.php 中将$config['index_page'] = 'index.php';设置为$config['index_page'] = '';?
标签: php .htaccess codeigniter ubuntu-server