移动codeigniter项目到Amazon EC2,htaccess以及ModRewrite问题项目、问题、Amazon、codeigniter

2023-09-02 11:25:27 作者:Peach 桃子

我试图从一个共享的托管服务Amazon EC2的移动我的codeigniter项目和正在运行与我的.htaccess设置一些挑战。这些设置使我没有包括的index.php在URL中。我的previous的.htaccess显示下方,和预期一样与我的previous托管服务提供商:

I am attempting to move my Codeigniter projects from a shared hosting service to Amazon EC2 and am running into some challenges with my .htaccess settings. These settings enabled me to not have to include index.php in the url. My previous .htaccess is shown below and worked as expected with my previous hosting provider:

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /simple.com/
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
   ErrorDocument 404 /index.php
</IfModule>

使用我的Amazon EC2实例,我现在已经完全进入了LAMP堆栈和证实,URL重写模块使能。

With my Amazon EC2 instance, I now have full access to the LAMP stack and have confirmed that the Apache Mod_Rewrite module is enabled.

我已经建立了我的EC2实例有两个虚拟主机目录,每一个我的网站。这两个网站服务按预期的CI的应用程序,但需要的index.php是在URL中。

I have set up my EC2 instance with two Virtual Host directories, one for each of my sites. Both sites serve up their CI applications as expected, but require index.php to be in the url.

我试着插入.htaccess文件我的亚马逊EC2公共路径如下,但仍然没有运气:

I've tried inserting my Amazon EC2 public path into the .htaccess file as follows but still no luck:

RewriteBase /ec2-55-27-191-14.compute-1.amazonaws.com/simple/

我相信这是100%的用户错误在我的一部分,将大大AP preciate您诊断!

I am sure this is 100% user error on my part and would greatly appreciate your diagnosis!

推荐答案

要回答我的问题...

To answer my own question...

我结束了从有的allowOverride =无为AllowOverride =所有改变Apache的文件/ etc /阿帕奇/站点可用/默认。

I wound up changing the Apache file /etc/apache/sites-available/default from AllowOverRide = None to AllowOverRide = All.