Part of the EllisLab Network
   
 
Running CI on Amazon Servers - Trouble with htaccess
Posted: 07 November 2008 07:10 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  07-16-2008

Ok, I can’t believe that I am having trouble with this - but I can’t get htaccess to work on amazons servers!

I have tried all of these and I can’t access the page without the “index.php” file in the URL!

<IfModule mod_rewrite.c>
  
RewriteEngine On
  RewriteBase
/dev4/
  
#RewriteBase /
  
RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond
%{REQUEST_FILENAME} !-d
  RewriteRule
^(.*)$ /index.php/$1 [L]
</IfModule>
# Deny OR Allow Folder Indexes.
# Since we disable access to PHP files you
# can leave this on without worries.
# OR better yet, create a .htaccess file in
# the dir you want to allow browsing and
# set it to +Indexes
Options -Indexes

Options
+FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
    
# mod_rewrite rules
    
RewriteEngine on
    
    
# The RewriteBase of the system (if you are using this sytem in a sub-folder).
    #RewriteBase /
    #RewriteBase /dev4
    
    # If the file is NOT the index.php file
    
RewriteCond %{REQUEST_FILENAME} !index.php
    
# Hide all PHP files so none can be accessed by HTTP
    
RewriteRule (.*)\.php$ index.php/$1
    
    
# If the file/dir is NOT real go to index
    
RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond
%{REQUEST_FILENAME} !-d
    RewriteRule
^(.*)$ index.php/$1 [QSA,L]
    
</IfModule>

# If Mod_ewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
    
ErrorDocument 404 index.php
</IfModule>

The address is something like http://sub.site.com/dev4/
Has anyone ever used the Amazon servers before and knows some trick I don’t?


accessing http://sub.site.com/dev4/welcome/ gives me an apache not found error, and accessing http://sub.site.com/dev4/index.php/welcome/ gives me a CI 404 error.

I have removed the $config[‘index_page’] = “”; as well.

 Signature 

My Blog, C2D, PHP Videos, CXTags, Super .htaccess, Extra hooks, and MicroMVC

Profile
 
 
Posted: 07 November 2008 08:29 PM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  2634
Joined  06-10-2007

Try this setup, it may help. http://codeigniter.com/forums/viewthread/96347/

 Signature 

URI Language Identifier | Modular Extensions - PHP5 | Modular Separation - PHP5 | Widget plugin | Access Control library

Profile
 
 
Posted: 07 November 2008 09:26 PM   [ Ignore ]   [ # 2 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5968
Joined  11-23-2003

I’m horrible with htaccess, but then again, I use Nginx for my own servers.  But Amazon’s servers are no different than any other VPS.  You have total control over the OS and all the server software.  You can even run Windows and Solaris if you want.

Which AMI are you using?  Keep in mind not all the images are setup for a production ready hosting environment out of the box.  You might have to do some installation / configuration or your web server.

Profile
 
 
Posted: 08 November 2008 12:06 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  07-16-2008

Nope, none of that worked either.

http://codeigniter.com/forums/viewthread/96347/
http://codeigniter.com/forums/viewthread/92609/
http://codeigniter.com/forums/viewthread/60406/


Also, I don’t know much about the server - just that it is on AWS and that other the rewrites work with the “index.php” part in the url.

Apache/2.2.3 (CentOS) Server
 Signature 

My Blog, C2D, PHP Videos, CXTags, Super .htaccess, Extra hooks, and MicroMVC

Profile
 
 
Posted: 08 November 2008 02:49 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  492
Joined  07-16-2008
Xeoncross - 08 November 2008 12:06 PM

Nope, none of that worked either.

http://codeigniter.com/forums/viewthread/96347/
http://codeigniter.com/forums/viewthread/92609/
http://codeigniter.com/forums/viewthread/60406/


Also, I don’t know much about the server - just that it is on AWS and that other the rewrites work with the “index.php” part in the url.

Apache/2.2.3 (CentOS) Server



EDIT:

Duh! it appears that the server admins thought they setup mod_rewrite! I see the module is loaded by Apache and .htaccess files are allowed - but no rules work! I guess we’re missing something!

Thanks anyway!

 Signature 

My Blog, C2D, PHP Videos, CXTags, Super .htaccess, Extra hooks, and MicroMVC

Profile
 
 
Posted: 09 November 2008 09:08 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  271
Joined  03-26-2006

Hey… I’ve been working on EC2 a great deal recently.
I’ve tended not to use any of the ‘pre-built’ AMI’s out there which claim to be LAMP setups for just these reasons. Instead, try the basic Ubuntu server installs, then build the AMI you want.

Login to the server. Install Apache2, php5, all the apache modules you want, then bundle that distro up as your own AMI. Then you’re good to deploy that exact setup to a new instance as soon as you want to scale.

Elliot

 Signature 

On the first day, God created CodeIgniter… Then he could really get some work done!

Elliot Haughin CodeIgniter Blog | FilePanda - Free File Sharing | Web Development Screencasts
Twitter | Flickr

Profile
 
 
Posted: 19 July 2009 10:36 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
RankRank
Total Posts:  108
Joined  12-15-2007

Hi Elliott,
I am interested in putting CI on EC2. I saw your post. Is that still your general sentiment?

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 10:15 AM
Total Registered Members: 119599 Total Logged-in Users: 39
Total Topics: 125834 Total Anonymous Users: 3
Total Replies: 662160 Total Guests: 356
Total Posts: 787994    
Members ( View Memberlist )