Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7511275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:30:05+00:00 2026-05-29T23:30:05+00:00

I am new to Codeigniter and using Codeigniter 1.7, I created a .htaccess file

  • 0

I am new to Codeigniter and using Codeigniter 1.7, I created a .htaccess file in root directory with code:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /ci/index.php/$1 [L]

to remove index.php from urls, and added

$config['url_suffix'] = ".html";

to config.php file to provide default suffix for all pages. After that I created a controller test.php with this code:

class Test extends Controller{

function test(){
    parent::Controller();
}

function index(){
    $this->load->view('test');
}

}

and a view also:

<?php
    echo anchor(current_url(), 'This Page');
?>

When I navigate to http://localhost/ci/test.html it works fine, but when I click the link auto generated by anchor() function in my view it goes to http://localhost/ci/index.php/test.html

How can I remove /index.php/ from urls generated by anchor() function?

Also when i point to home page

localhost/ci/index.html

it shows me a 404 Page not found error but when I point to

localhost/ci/index.php

it works fine. Why home page is not being converted to index.html instead of index.php?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:30:12+00:00Added an answer on May 29, 2026 at 11:30 pm

    You have to create a rewrite condition with htaccess.
    To remove index.php, add this to the root folder .htaccess file

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

    If your loading Test as your default controller then this will be your base url

    localhost/ci/
    or
    localhost/ci/test/
    or
    localhost/ci/test/index.html

    Make sure to set your config.php to this

    $config['index_page'] = ''
    

    You should also be using Codeigniter 2.1 for proper php 5 support.

    Also your constructor funciton should be like so if using php 5. Else stick with what you have for php 4.

    public function __construct()
    {
        parent::__construct();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to MVC (I'm using codeigniter) and was wondering where I should put
I'm new to PHP, started with Code Igniter and MAMP. I start the server
I'm using CodeIgniter to develop a new web app, and I'd like to create
I want to create secure cf using CodeIgniter. I'm new to using CodeIgniter. Is
I'm using Codeigniter..and I'm new to this. What I'm trying to do is to
Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm
I am using codeigniter's session class to handle my PHP sessions. One of the
New to HMVC in Codeigniter. Dynamic form allows new segments to be created when
I've created a site using CodeIgniter and its build in session class. I've uploaded
hi i am new at codeigniter. i want to change my div tag using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.