If you’re using one of the newer versions of CI, there is an .htaccess file inside the application directory that denies any direct requests for it. Assuming you’ve copied the application folder and renamed it “admin”, that .htaccess folder is still there. When you access a URL that begins with “admin”, it will find the physical directory, see that there is another .htaccess file inside of it, and automatically give it priority, effectively denying all requests. There is also the problem with the directory check in the home .htaccess - since it’s a valid physical directory, the admin rewrite won’t be initiated.
1. Don’t name your admin application folder “admin”. Name it something else. Update your admin.php “index” file appropriately.
2. RewriteCond lines are only valid for a single RewriteRule call. Once you call a RewriteRule, you need to duplicate any of the same RewriteCond, or they will not be available.
3. In your admin’s config.php file, you do not HAVE to use the index_page setting. However, if you add “admin” to it, CI’s convenient URL helpers will automatically prepend that segment, making creating links a little easier. Then you can do things like this:
echo site_url('viewposts'); // Generates: http://mysite.com/admin/viewposts
4. Here is a more suitable .htaccess for you to at least start with. Add to it where necessary:
Options +FollowSymlinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /muki
# Admin URLs
# RewriteCond's are not necessary here if there will be no
# static assets (images/css/js) whose URLs start with "admin"
RewriteRule ^admin(/.*)?$ admin.php/$1 [L,QSA]
# Public website
# The first two rules say "If this path is not an existing file or directory"
# The third conditional is good for preventing rewrites for directories
# commonly accessed for static assets. It will prevent unnecessary calls to
# your application if there are any 404 errors in those directories.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(images|css|js)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>