CodeIgniter Forums

Full Version: use CI as micro engine without views folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I'm working on a project which is an engine to do something based on inputs.
This project is using controller and model only to read / save manipulated data or return some results to the referrer URL.

I wanna hide this engine-CI view pages from users who wants to have direct access to the views or search engines.
My question is how to delete/redirect/block the direct URLs to my engine-CI?

Thanks guys
You need to implement authorization methods in engine-CI. 

you can build engine-CI as an ReSTful api 
https://github.com/chriskacerguis/codeig...restserver
(04-18-2017, 03:21 AM)neuron Wrote: [ -> ]You need to implement authorization methods in engine-CI. 

you can build engine-CI as an ReSTful api 
https://github.com/chriskacerguis/codeig...restserver

I'm planing to make the CI as an API but what will happen if user directly insert http:// example.com/engine/ then the CI will display the default route which is 'welcome'. I wanna screw the view or direct access like http://example.com/engine/reports

Sorry maybe my question sounds silly but it's my first time to do this. Please guide me more

Thanks
I am also noob Smile

how about filterin by IP in htaccess ? or in index.php  check remote IP address.

if u implement ReST API. rest server this library has built in authentication methods. in rest library config u can set valid user that are able to connect to ur engine-ci api
$config['rest_valid_logins'] = ['admin' => '1234'];
or u can set IP whitelist $config['rest_ip_whitelist_enabled'] = FALSE;

if connection is not secure (not https) $config['rest_valid_logins'] = ['admin' => '1234']; is not secure
You can change the default route in config/routes.php and point it to a controller with a method which uses show_404() if that is the desired effect (https://codeigniter.com/user_guide/gener...=#show_404).