4

I am not to clued up on these and I'm struggling to get this one working.

I just keep getting 404 errors, can someone give me a hand?

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

This is what I have so far. I'm using the CodeIgniter framework.

peterh
  • 11,875
  • 18
  • 85
  • 108
  • 3
    Is mod_rewrite enabled in Apache? where do you get this error? in server or in local machine? – Lepanto Mar 29 '14 at 07:21
  • I'm not sure you need the 3rd line. The last line should do the re-write. Try commenting out the 3rd line. – jd182 Mar 29 '14 at 07:26
  • i have taken out the third line and still no joy and its server side and i have used the framework before on my hosting so im guessing it should be – Morby-Raybould Mar 29 '14 at 08:47

7 Answers7

0

can you please try this code in the htaccess file..

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

this one works fine at my instance...

Yogesh Pawar
  • 336
  • 2
  • 17
0

This one works fine with my site on goDady

<IfModule mod_rewrite.c>

    Options +FollowSymLinks
    RewriteEngine on

    # This one is important for goDaddy
    RewriteBase /


    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    # or you can use like this also 
    RewriteRule ^(.*)$ index.php?url=$1 [L]

</IfModule>

My folder Structure was like this

/
|
 -->mysite
       |
        -->system (d)
       |
        -->application (d)
       |
        -->.htaccess (f)
       |
        -->index.php (f)     

and in config.php

$config['index_page'] = 'index.php';

in routes.php

$route['default_controller'] = "home"; // whatever default controller

Sometimes GoDaddy takes little time to get update .htaccess, So please give some time for each try. And don’t forget to clear out your browser cache. Ctrl+F5 in Firefox to refresh without cache.

Sanoob
  • 2,466
  • 4
  • 30
  • 38
  • @Morby-Raybould have you tried with default codeIgniter application folder? I mean without changing anything. Are you getting 404 error from codeIgniter or apache ? – Sanoob Mar 29 '14 at 21:38
0

Try this code

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1
Chinthu
  • 277
  • 3
  • 5
  • 16
0

Try this code, Its work for me. I tested it in XAMP, WAMP on my windows pc as well as in my UBUNTU and CentOS Server. And my codeigniter version is (2.1.0)

RewriteEngine on

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

Bikram Pahi
  • 1,107
  • 1
  • 12
  • 33
0

use this as ur .htaccess file and check mod rewrite is enabled

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 
Bugfixer
  • 2,547
  • 2
  • 26
  • 42
0

try this

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

config > config.php

$config['base_url'] = '';

$config['index_page'] = '';

$config['uri_protocol'] = 'AUTO';
KBK
  • 375
  • 1
  • 4
  • 20
0
try this.

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