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

  • Home
  • SEARCH
  • 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 1008337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:45:23+00:00 2026-05-16T08:45:23+00:00

I have a problem with CodeIgniter .htaccess file and hope that somebody can help

  • 0

I have a problem with CodeIgniter .htaccess file and hope that somebody can help me!
I don’t know regular expressions or how to use the .htaccess, I’m very new with this things!

My Problem is:

I have this structure of files (multi application):

- application
    - admin
    - site
- system
- index.php
- admin.php

And this .htaccess (that works fine on localhost!)

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]

What I want to do is:

Access my web site (frontend) with http://www.mydomain.com/
And my admin (backend) as http://www.mydomain.com/admin/

I don’t know why this works fine on my local server.

I hope someone can help me.

UPDATE

I got it to work using this:

RewriteEngine on

# If the user types "index.php" or "admin.php".
RewriteCond $1 !^(index\.php|admin\.php|images|robots\.txt)

# If the user types just "admin".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin$ admin\.php [L,QSA]

# If the user enter in any admin section, like "admin/section".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin\/(.*)$ admin\.php/$1 [L,QSA]

# If the user types any site section, like "site/section".
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index\.php/$1 [L,QSA]

This way I can access http://www.mydomain.com/admin or http://www.mydomain.com/admin/any-section (that points to “admin.php” on the root directory)

And I can access http://www.mydomain.com/ or http://www.mydomain.com/any-section (that points to “index.php” on the root directory)

Thanks for the help!

  • 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-16T08:45:24+00:00Added an answer on May 16, 2026 at 8:45 am

    First of all this is redundant:

    RewriteCond $1 !^(index\.php|images|robots\.txt)
    

    because your other conditions already take care of existing files and directories so I’d suggest to remove it.

    Your rewrite rule is wrong if you want /admin to rewrite to admin.php, with your current rule it will result in /index.php/admin. You didn’t mention if that’s the problem, if it is do this:

    RewriteRule ^/admin$ admin.php [L,QSA]
    RewriteRule ^(.*) index.php/$1 [L,QSA]
    

    Also you can debug the rewriting using RewriteLog: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog

    If that doesn’t fix it please describe the current behaviour and what you expect, otherwise it’s difficult to help.

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

Sidebar

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.