Jump to content

Blocking access to admin Codeigniter panel via .htaccess


fluidsharp

Recommended Posts

Hi,

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 weeks later...

Assuming, the root web tree structure is like:

 

/ - web root

 

/admin

 

/admin/main

 

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.