![]() |
Redirect Help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Redirect Help (/showthread.php?tid=76870) |
Redirect Help - zpupster - 06-28-2020 [attachment=1811][attachment=1811]Hello support, I am new to CodeIgniter. I am following this tutorial. https://www.youtube.com/watch?v=TC_9EuMTPN4&t=1090s I am on Xampp On W10 and i have a form with this URL: (see attachment) [/url] Code: http://localhost:8888/codei4/public/blog/create The Problem is with the redirect: Code: return redirect()->to('/'); I have tried searching all i am getting is this is a bug in CodeIgniter4---- Is there a Solution ??????? When I press the submit(create) button, ti takes me to this URL: Code: http://localhost:8888/blog/create/ Config/App: Code: public $baseURL = 'http://localhost:8888/codei4/public'; Code: Options +FollowSymLinks Routes look like this: Code: $routes->get('/', 'Pages::index'); I have tried hard coding(codei4/public in front of every instance of blog/create in my code. I need help. If you need further Info --Let me know. thank you RE: Redirect Help - inumaru - 06-30-2020 So, is your problem is when you submit your form it got you 404? And did your submitted form data got in into your database? Maybe try change the route into: PHP Code: $routes->get('/', 'Pages::index'); RE: Redirect Help - tgix - 06-30-2020 Are you using the .htaccess that is shipped with CI4 in the public directory? The RewriteBase directive needs to be changed if you are running in a subfolder (as is indicated in the comment of that file). RE: Redirect Help - inumaru - 07-01-2020 Oh right, as tgix say. I set my base_url to be dynamic so i don't need to change my .htaccess file. app/Config/Constants.php PHP Code: $protocol= (isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST']; app/Config/App.php PHP Code: public $baseURL = BASE; |