2

I am very much new to codeigniter. I have a codeigniter project and i need to do some changes.I have pasted it into htdocs and changed application/config/config.php 's base_url to localhost's path.

and changed database connection inside application/config/database.php

after above changes , my index page is opening well on localhost.But all the links from index page redirects to http://localhost/dashboard/ .

I did not changed .htaccess file content. here it is :

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

How to solve this ?

2
  • 1
    Its with this RewriteBase / Mar 6, 2017 at 6:07
  • you need to remove index.php ? Mar 6, 2017 at 6:08

3 Answers 3

8

if you need to remove index.php then use this

RewriteEngine on

RewriteCond $1 !^(index\.php|assets|image|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
7
  • using this code , now it is not redirecting to localhost/dashboard. It is opening links now like , localhost/backup-3.1.2017_17-43-40_travocoaster/homedir/… , but page says An Error Was Encountered , Unable to load the requested file: frontend/brochures.php . for all the url s Mar 6, 2017 at 6:15
  • how you call this file frontend/brochures.php add code please Mar 6, 2017 at 6:16
  • for example this link localhost/backup-3.1.2017_17-43-40_travocoaster/homedir/… says , Unable to load the requested file: frontend/brochures.php . But I did not find any route related to this , inside application/config/routes.php file . Mar 6, 2017 at 6:20
  • no i asked how you call this file on your view frontend/brochures.php ?? Mar 6, 2017 at 6:21
  • I just found that inside views/ folder there is no file "brochures.php" hence error. thanks for your time . Mar 6, 2017 at 6:24
2
RewriteEngine on
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php/$1 [L]

try this

0

I got the same issue and solved by doing the following.

If you are using CodeIgniter 4, go to app/config/app.php file and replace this:

public $indexPage = 'index.php';

With this:

public $indexPage = '';

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.