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 7820747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:24:58+00:00 2026-06-02T07:24:58+00:00

Each time it’s time to deploy a CodeIgniter application, I find myself struggling with

  • 0

Each time it’s time to deploy a CodeIgniter application, I find myself struggling with changing the path in the .htaccess. Therefore; I’m looking for a proper, good working solution which works no matter of the location of the actual project.

Obstacle: My local testing enviroment isn’t localhost/ but rather localhost/project. This won’t, most likely, be the case in the live enviroment (more likely /). Hence, I’d prefer a solution which works anyway.

My current .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

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

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

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /project/index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /project/index.php
</IfModule>  

Using only index.php as a path won’t work. It gives me an 404 not found error.
Have tried a lot of different combinations, and would love to see your suggestions. Thanks!

  • 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-06-02T07:25:00+00:00Added an answer on June 2, 2026 at 7:25 am

    Personally I dont like your denying of system and application folers in .htaccess.

    Per the “best practice on CI” guide found here (http://codeigniter.com/forums/viewthread/125687/) – you should move your application and system folders OUT of public_html, leaving only index.php. Then NO MATTER WHAT fancy stuff people try – they cant access your application & system folders from http.

    Then meanwhile – here is my .htaccess file that I use on ALL projects – with no modification required for ANY. It just “works” (for me).

    Options -Indexes
    Options +FollowSymLinks
    
    # Set the default file for indexes
    DirectoryIndex index.php
    
    <IfModule mod_rewrite.c> 
            # activate URL rewriting 
            RewriteEngine on  
    
            # do not rewrite links to the documentation, assets and public files 
            RewriteCond $1 !^(files|css|js|assets|uploads|captcha)
    
            # do not rewrite for php files in the document root, robots.txt                  
            RewriteCond $1 !^([^\..]+\.php|robots\.txt) 
    
            # but rewrite everything else   
            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. 
            ErrorDocument 404 index.php 
      </IfModule>   
    

    Oh – and I use this for my multiple projects on localhost. i.e. localhost/project1 , localhost/project2

    just put a copy of the htaccess file in the root of each project. I DONT have this file in my root localhost

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Each time I deploy my application either on my laptop (Vista) or on my
Each time i run on my local machine cap:deploy i get next error when
Each time I try to deploy my server side code, the build fails. If
I create socket connection each time user logs into my application. This means if
Each time I build a Catalyst application I come to a point where the
My Visual Studio crashes each time I try to debug my ASP.net application. I've
My application gets killed each time that it comes back from the screen-off-state. I
I store current time in database each time application starts by user. Calendar c
I want that each time i'll be pressing a button the application will draw
Each time a python file is imported that contains a large quantity of static

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.