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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:15:23+00:00 2026-06-13T07:15:23+00:00

I am using htaccess to rewrite my URL’s… with codeigniter, to be specific. I

  • 0

I am using htaccess to rewrite my URL’s… with codeigniter, to be specific. I Have two applications, one called “frontend”, the other called “admincp”. The front end application uses index.php with $application_folder changed to “frontend”. The admincp application uses a copied index.php, but renamed to admin.php. The $application_folder is changed to “admincp” in this file.

Basically, I want all URi’s that contain “admincp” as the first uri segment to be rewritten to the admin.php file instead of index.php. Then, all other URL’s to be rewritten as usual… to index.php.

mysite.com/admin/members would go to admin.php/members
mysite.com/articles/Some-Awesome-Articles would go to index.php/articles

I hope I have explained this well enough… Anyway, here is my current htaccess file, but it doesn’t seem to work. I get an internal server error.

 # Deny OR Allow Folder Indexes.
# Since we disable access to PHP files you 
# can leave this on without worries. 
# OR better yet, create a .htaccess file in
# the dir you want to allow browsing and
# set it to +Indexes
Options -Indexes

Options +FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
    # mod_rewrite rules
    RewriteEngine on

    # The RewriteBase of the system (if you are using this sytem in a sub-folder).
    # RewriteBase /CodeIgniter_1.6.3/

    # This will make the site only accessible without the "www." 
    # (which will keep the subdomain-sensive config file happy)
    # If you want the site to be accessed WITH the "www." 
    # comment-out the following two lines.
    # RewriteCond %{HTTP_HOST} ^www\.site\.com$ [NC]
    # RewriteRule ^(.*)$ http://site.com/$1 [L,R=301]

    # If a controler can't be found - then issue a 404 error from PHP
    # Error messages (via the "error" plugin)
    # ErrorDocument 403 /index.php/403/
    # ErrorDocument 404 /index.php/404/
    # ErrorDocument 500 /index.php/500/

    # Deny any people (or bots) from the following sites: (to stop spam comments)
    # RewriteCond %{HTTP_REFERER} nienschanz\.ru [NC,OR]
    # RewriteCond %{HTTP_REFERER} porn\.com
    # RewriteRule .* - [F]
    # Note: if you are having trouble from a certain URL just 
    # add it above to forbide all visitors from that site.

    # You can also uncomment this if you know the IP:
    # Deny from 192.168.1.1

    # If the file is NOT the index.php file
    RewriteCond %{REQUEST_FILENAME} !index.php
    # Hide all PHP files so none can be accessed by HTTP
    RewriteRule (.*)\.php$ index.php/$1

    # If the file/dir is NOT real go to index
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^admin/(.*)$ admin.php/$1
    RewriteRule ^(.*)$ index.php/$1

</IfModule>

# If Mod_ewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>  

  • 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-13T07:15:24+00:00Added an answer on June 13, 2026 at 7:15 am

    The first rule that you have will rewrite admin.php itself, and it looks like you’re ending up with something like /index.php/admin.php. Also, the 2 conditions that check for !-f and !-d only get applied to the RewriteRule ^admin/(.*)$ admin.php/$1 rule. Rewrite conditions only get applied to the single immediately following rewrite rule. So your RewriteRule ^(.*)$ index.php/$1 rule doesn’t have any conditions, and will blindly rewrite every URI. You also have no flags so rewriting continues right through to the end (thus clobbering any rewriting that you did before).

    You need to rearrange the rules:

    # rewrite if the request starts with `/admin/`
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^admin/(.*)$ admin.php/$1 [L]
    
    # not even sure why you need this...
    RewriteCond %{REQUEST_FILENAME} !index.php
    RewriteCond %{REQUEST_FILENAME} !admin.php
    RewriteRule (.*)\.php$ index.php/$1 [L]
    
    # everything else
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in codeigniter project I want to rewrite my URL using htaccess.
I need to rewrite a URL using an .htaccess and the URL has two
I am trying to rewrite a URL using .htaccess. I am running on Apache
I'm using .htaccess (mod rewrite) to have pretty looking SEO friendly URLs. I have
I have a URL like this http://www.freshupnow.com/movie.php?moviename=A+Flat I want to rewrite this URL using
Using .htaccess , how can I rewrite the URL, such that when a visitor
I have two types of urls: http://mydomain.com/npguar/en/products.php http://mydomain.com/npguar/en/1/product_specification.php Earlier I was using this .htaccess
I want to rewrite URLs using .htaccess I want mod_rewrite to match ANY URL
It is possible to rewrite my url using mod_rewrite and htaccess where a user
How to rewrite URL like this http://localhost/gestor_3.0/index.php?p=cadastros&t=operadoras to http://localhost/gestor_3.0/cadastros/operadoras using htaccess and mod_rewrite.

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.