我有一个使用CodeIgniter创建的网站,尽管URL重写正在我的本地安装(WAMP)上工作,但它在远程服务器上失败。CodeIgniter:URL重写不起作用
CI框架安装在“/ dev”文件夹中。
这里的错误,当我尝试使用以下URL访问控制:http://www.mywebsite.com/dev/controller
未找到
请求的URL /dev/index.php/controller/此服务器上未找到。
我试过每个.htaccess和config.php的组合,但我找不出什么是错的。
但是,http://www.mywebsite.com/dev/工作得很好。
这里的.htaccess文件:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
和应用程序/配置/ config.php文件:
$config['base_url'] = '/dev/'; # I tried to put the whole path, didn't work either
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING'; # I tried every possibility, none of them work
$config['url_suffix'] = '';
什么是真正奇怪的是,这种精确的配置中使用到另一台服务器上运行,我今天移动了我的代码,现在它不工作...
任何想法?
设置URI协议PATH_INFO没有工作,但是你的第二个解决方案被证明是有效的。 功能答案在不到5分钟内,上帝我爱Stackoverflow。谢谢 ! – roberto06 2014-09-29 14:47:01