1

I coded my web application on windows, and I am pushing it to my server, which runs Ubuntu Linux. Here is my .htaccess file:

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

<IfModule !mod_rewrite.c>
  # If we don't have mod_rewrite installed, all 404's
  # can be sent to index.php, and everything works as normal.
  ErrorDocument 404 /index.php
</IfModule>

My file at /etc/apache2/sites-available/default is as follows:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

I typed sudo a2enmod rewrite into the command line on my ubuntu server, and it says mod_rewrite is already turned on.

As I debugged through my codeigniter application, the error seemed to show up on line 308 in CodeIgniter.php, which is:

$CI = new $class();

Can someone please let me know what is going on?

GabeMeister
  • 1,138
  • 3
  • 17
  • 25

3 Answers3

4
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]  

Try this .htaccess code, and restart your apache

If this does not work please try this link

How to enable mod_rewrite for Apache 2.2

Community
  • 1
  • 1
Jewel
  • 2,053
  • 21
  • 21
1

I had to edit:

/etc/apache2/apache2.conf

and set:

<Directory /var/www/html>
    # ... other directives...
    AllowOverride All
 </Directory>

And then restart apache, in order for the above .htaccess code to be read.

paulc
  • 325
  • 3
  • 9
1

Create a .htaccess file in your CI project folder. Enter the code below in the file.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
NathanOliver
  • 150,499
  • 26
  • 240
  • 331