我的htaccess文件在localhost上工作,但在将其部署到EC2实例时不起作用.
我正在使用Macbook,在查找器中我看不到htaccess文件,我想也许它没有被复制到EC2实例但我不认为这是问题因为当我复制项目时我可以看到htaccess文件在我的编辑器中.
在EC2 linux实例中是否有一些启用mod重写的东西?如果有,我没有这样做或它默认启用mod重写?
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud) 我有一个我在codeiginiter 2.0.1(我自己的个人网站)上建立的网站.我使用WAMP在本地构建了这个应用程序,它可以100%正常工作(本地).我将其上传到我的实时服务器,并且一直收到"找不到404页面"错误.这个错误来自codeigniter通过我的Home-> Error方法,而不是服务器,因此代码点火器肯定是有效的.
这是我的路线配置.如果我将404_override更改为"Home".它会加载我的家庭控制器,但是当我转到任何页面时,我找不到404页面.
$route['default_controller'] = 'Home';
$route['404_override'] = 'Home/Error';
Run Code Online (Sandbox Code Playgroud)
我怀疑这可能与我的.htaccess和Codeigniter配置有关.
// Codeigniter Config.php - Note: My Hosting is with Godaddy. [CGI/FastCGI]
$config['index_page'] = 'index.php?';
// Tried Auto and All others, REQUEST_URI works fastest for me.
$config['uri_protocol'] = 'REQUEST_URI';
Run Code Online (Sandbox Code Playgroud)
我的.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
Run Code Online (Sandbox Code Playgroud)
我通过SO和Google尝试了很多这样的链接来解决这个问题,我重复尝试的那些链接在下面.
- CodeIgniter 404找不到页面,但为什么?
- 现有的控制器上的笨404
- http://codeigniter.com/forums/viewthread/60469/#297477
- http://codeigniter.com/wiki/Godaddy_Installaton_Tips
-以及很多其他
我敢肯定这已经与htaccess和mod_rewrite,任何想法?
$route['404_override'] = 'Home/Error'为我的任何控制器,它们会按预期显示和工作,但由于某种原因,它总是会抛出404页面.
如果我去:/index.php/home- 我得到错误No input …