Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here's what I want to do: I'm using CodeIgniter, so all URLs are in the form of However, the script I've written is a essentially a glorified link shortener with some built-in statistics functions, so I want all of the URLs to be in the form of However, I would also like the script's admin panel to be available at I adapted the CodeIgniter "remove index.php from URLs" example .htaccess to fit my situation, and it works correctly on my localhost (EasyPHP 5.3.9), but when I upload it to the production server (HostGator), all of the requests for the administration panel are being handled like a regular link and passed to the link controller (index.php/redirection/link) instead of the admin controller (index.php/admin). Here's my .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Removes access to the system folder by users.
    # Additionally this will allow you to create a System.php controller,
    # previously this would not have been possible.
    # 'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ index.php/$1 [L]

    # When your application folder isn't in the system folder
    # This snippet prevents user access to the application folder
    # Submitted by: Fabdrol
    # Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ index.php/$1 [L]

    # Checks to see if the user is attempting to access the administration panel,
    # and if so sends the request to the admin controller
    RewriteRule ^admin/?$ index.php/admin/ [L]
    RewriteRule ^admin/([^.]+)/?$ index.php/admin/$1 [L]

    # Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isn't true it sends the
    # request to the redirect controller
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/redirection/link/$1 [L]

<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

Is there something I'm doing wrong? Any help or suggestions would be appreciated!


locked by HopelessN00b Mar 16 '15 at 1:47

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as off-topic by HopelessN00b Mar 16 '15 at 1:46

  • This question does not appear to be about server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Do you know if the "AllowOverride" option is set correctly that you are actually allowed to use htaccess files to the full potential ? – Richard Jun 7 '12 at 2:25
@Richard No, I don't know, and it doesn't seem to be listed in phpInfo. I will contact HostGator about this tomorrow to see if it's something on their end (I actually didn't think about that!). Still, if anyone sees any other issues, please let me know! – stevenmirabito Jun 7 '12 at 2:51

Remove the below lines from .htaccess

RewriteRule ^admin/?$ index.php/admin/ [L]
RewriteRule ^admin/([^.]+)/?$ index.php/admin/$1 [L]

Add this two line routes.php




Here welcome.php is a controller places at application\controllers\admin\welcome.php


Below the command "RewriteEngine On"put "RewriteBase /" or "RewriteBase /app_name/" if your application is in a subdirectory "app_name".

Hope that helps.



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