【发布时间】:2015-08-29 00:21:24
【问题描述】:
我在PHP 中使用Codeigniter 框架。我的网站在 apache 服务器上。路径:/var/www/example.com/public_html
.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
但我在访问此页面时仍然收到此错误:www.example.com/test/wallet:
在此服务器上找不到请求的 URL /test/wallet。
屏幕截图
当我使用www.example.com/index.php/test/wallet 时,它就可以工作了...
【问题讨论】:
-
检查你的控制器文件和方法。你能分享我们控制器代码吗?你使用 CodeIgniter v3 吗?
-
您是否将
config.php中的$config['index_page'] = 'index.php';更改为$config['index_page'] = '';?看起来您的 .htaccess 正在尝试从 URL 中删除 index.php。 -
example.com/index.php/test/walletURL 有效吗? -
开始于:有什么用吗? :)
-
@Bora:是的。该网址有效
标签: php .htaccess codeigniter