redirect not working - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: redirect not working (/showthread.php?tid=465) Pages:
1
2
|
redirect not working - hadeel - 12-08-2014 Hi, my redirect function to admin dashboard is not working but it was working yesterday i have tried every thing in .htaccess and config and route files i dont know what to do? is it need to update codeigniter ? RE: redirect not working - sv3tli0 - 12-08-2014 There must be some kind of change on your script/server so something working yesterday not to work today. How ever if you want help you have to show us your code where the bug is coming out else how the hell we can know what is causing it ? RE: redirect not working - hadeel - 12-08-2014 this is my htaccess : <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|images|img|js|sexyimages|media|roleimages|lang|uploads|files|profile|audio|video|videoplayer|talentimages|captcha|gmap|timthumb|include|ckeditor|webfonts|player|robots\.txt|css|sitemap\.xml|sitemap\.html|BingSiteAuth\.xml) RewriteRule ^(.*)$ ./index.php/$1 [L] </IfModule> and this is my admin login code <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Home extends CI_Controller { function __construct() { // Call the Model constructor parent::__construct(); $this->load->model('admin/adminloginmodel','', TRUE); $this->load->library('session'); } public function index() { //$objResponse=new xajaxResponse(); $this->load->helper('url'); $data['msg']= ''; if(isset($_POST['submit'])) { $msg=$this->adminloginmodel->check_adminlogin(); //echo $msg; if($msg != 'success') { //redirect('admin/dashboard', 'refresh'); $data['msg']= $msg; } else { redirect(site_url('admin/dashboard')); } } $this->load->view('admin/adminhome_view',$data); } } /* End of file home.php */ /* Location: ./application/controllers/home.php */ RE: redirect not working - InsiteFX - 12-08-2014 Code: <IfModule mod_rewrite.c> RE: redirect not working - hadeel - 12-08-2014 i tried your code its now showing 404 not found error before it was loading the admin login form but the redirecting to dashboard after that showing empty page actually all login forms not working on the website RE: redirect not working - Avenirer - 12-08-2014 i see that your redirect is commented PHP Code: //redirect('admin/dashboard', 'refresh'); maybe that is the problem? RE: redirect not working - hadeel - 12-08-2014 I tried that also still not working RE: redirect not working - Dracula - 12-09-2014 (12-08-2014, 01:09 PM)hadeel Wrote: I tried that also still not working Replace this in your controller PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); And this in your .htaccess file Code: <IfModule mod_rewrite.c> RE: redirect not working - hadeel - 12-10-2014 i have tried your code still same problem and if changed the .htaccess all pages will be not working RE: redirect not working - Rufnex - 12-11-2014 For a redirect on your own server you dont need a url function. just write it in that way PHP Code: old code In your /application/controllers you must hava a Admin.php with a dashboard method. |