3

I've spent much time searching for an answer but found nobody with the same issue :).

My local version is fine (running on ampps), the urls without index.php are working great. My local and prod folders are both in subfolders so it's like :

http://localhost/ci/
http://website.com/cms_ci/

But when I put my folder on the prod server, the homepage is working but if I want to reach http://website.com/cms_ci/content/ I'm getting a 404. If I go on http://website.com/cms_ci/index.php/content/, it's working.

Here are the settings of my config and htaccess files :

config.php

$config['base_url'] = 'http://localhost:8080/cms/'; 
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';

HTACCESS

Options -Indexes
   RewriteEngine on
   RewriteCond $1 !^(index\.php|assets/|robots\.txt)
   RewriteRule ^(.*)$ index.php/$1 [L]

Of course on my prod config file I've changed

$config['base_url'] = 'http://localhost:8080/cms/'; 

to

$config['base_url'] = 'http://www.website.com/cms_ci/'; 

I tried all kind of htaccess files but now I'm kinda stucked.

Thanks in advance

ReNiSh AR
  • 2,782
  • 2
  • 30
  • 42
banibanc
  • 143
  • 3
  • 16

2 Answers2

0

Try this htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>
ReNiSh AR
  • 2,782
  • 2
  • 30
  • 42
  • Hello, I tried that but that doesn't change anything. I still can go to the homepage and to others pages when I use website.com/index.php/controller/. And I've still 404 when I'm trying website.com/controller/ – banibanc Apr 24 '14 at 09:58
  • try with: website.com/index.php?/controller/ – ReNiSh AR Apr 24 '14 at 10:05
  • whatever I put as url after the index.php? (webiste.com/index.php?/controller/) I'm going to the homepage. – banibanc Apr 24 '14 at 11:46
0

You can try this -

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index\.php|public|img|images|js|fonts|assets|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

This should work!

Gaurav
  • 549
  • 1
  • 5
  • 13