0

After removing my codeigniter project from a xampp server to a Live server i've got an error when trying to access my home page without index.php in front..

this is my route :

$route['home'] = 'Pages/view/home';

this is my config :

$config['index_page'] = '';
$config['base_url'] = 'http://mysite/newsite';
$config['uri_protocol'] = 'REQUEST_URI';

my .htaccess file :

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

so when i try to surf to www.mysite/home it gives me this error :

The requested URL /index.php/home was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

but when i surf to www.mysite/index.php/home it does work

I tried different htaccess files but without success

2
  • hi, in your htaccess you need to change RewriteRule ^(.*)$ /index.php/$1 [L] to RewriteRule ^(.*)$ /newsite/index.php/$1 [L] Commented Jun 8, 2017 at 16:37
  • @elddenmedio thanks ! worked like a charm! Commented Jun 8, 2017 at 16:51

1 Answer 1

0

I am on xampp with widows 10 I use these two

RewriteEngine on

# Next two lines get rid of trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

And

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Also with your base url I would put / at the end of it

$config['base_url'] = 'http://localhost/yourproject/';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.