Jump to content


Blocking access to admin Codeigniter panel via .htaccess

htaccess codeigniter

  • Please log in to reply
1 reply to this topic

#1 fluidsharp


    Advanced Member

  • Members
  • PipPipPip
  • 39 posts

Posted 09 November 2013 - 08:12 PM


How to block access to http://domain.com/admin/main/ admin panel via htaccess ?

I tried like below, but it is not working.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]

RewriteCond %{REMOTE_ADDR} ^1\.1\.1\.1$
RewriteRule /admin/main [F,L]


#2 jazzman1


    Advanced Member

  • Moderators
  • 2,715 posts
  • LocationMississauga, Canada

Posted 21 November 2013 - 11:04 AM

Assuming, the root web tree structure is like:


/ - web root






Put in next code inside /admin directory. 

RewriteEngine on
RewriteBase /admin/
RewriteRule ^\/?main\/.*$ - [F,NC]

You can also specify which type of files do not allow to be called:

RewriteEngine on
RewriteBase /admin/
#RewriteRule ^\/?main\/.*$ - [F,NC]
RewriteRule ^\/?main\/.*\.(jpg|jpeg|gif|png|bmp|php|pl)$ - [F,NC]

Edited by jazzman1, 21 November 2013 - 11:06 AM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users