0

I am using codeigniter 3.0 and xampp. When I try to reference a page in xampp with codeigniter it goes to the xampp index page.

Here is my .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and     leading
#  slashes.
# If your page resides at
#  http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
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.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule>
Lars Ebert
  • 3,487
  • 2
  • 24
  • 46

1 Answers1

1

You could try http://localhost/project/index.php/route-name But if your trying to do it without index.php try my example below.

Disclaimer: I do not know what versions of system/server you are running so could show a different result this is just example to help you along.

Create a file in main directory called .htaccess Do not touch the htaccess in application folder

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]

I use the same htaccess on my live server no issues Hosting Provider http://www.arvixe.com/9875-0-1-370.html

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

Also if you have any links that include index.php remove that also example.

base_url('index.php/route-name');

Change To

base_url('route-name');

Or

site_url('index.php/route-name');

Change To

site_url('route-name');

If you are still having issue check your routes.php make sure you have configured your routes in application/config/route.php $route['name'] = "route-name/index"; check your name of controller.

In codeigniter 3.0 you also need to have the controller capitalized. example Welcome.php

If that does not work I found this https://github.com/riwakawebsitedesigns/htaccess_for_codeigniter has about 5 examples you could try depending on your server / OS-system