Two backslash in url in virtualhost - 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: Two backslash in url in virtualhost (/showthread.php?tid=88175) |
Two backslash in url in virtualhost - pippuccio76 - 08-02-2023 Hi , i use xammp to testing my project in locale with windows using the guide of first response of this tread : https://stackoverflow.com/questions/27754367/how-to-set-up-apache-virtual-hosts-on-xampp-windows in C:\Windows\System32\drivers\etc i do : Code: 127.0.0.1 my_project Code: app.baseURL = 'http://my_project' Code: public function before(RequestInterface $request, $params = null) the system redirect me to the login (ok) but with this link : http://my_project//admin/login (with 2 / ) Why ? RE: Two backslash in url in virtualhost - kenjis - 08-02-2023 Because the baseURL should end with a slash (/). Try: base_url('admin/login'); RE: Two backslash in url in virtualhost - pippuccio76 - 08-12-2023 (08-02-2023, 11:29 PM)kenjis Wrote: Because the baseURL should end with a slash (/). same problem with base_url ending with / on hosting in subfolder RE: Two backslash in url in virtualhost - shortcode - 08-12-2023 remove the forward slash before admin in your redirect: "return redirect()->to(base_url() . '/admin/login');" <- wrong "return redirect()->to(base_url() . 'admin/login');" <- correct RE: Two backslash in url in virtualhost - JustJohnQ - 08-13-2023 What Kenji means is that your base_url is probably http://my_project/ including the backslash. To go to the admin page, you shouldn't use: Code: return redirect()->to(base_url().'/admin/login'); but: Code: return redirect()->to(base_url().'admin/login'); RE: Two backslash in url in virtualhost - ozornick - 08-13-2023 Why are you using merge instead of passing a parameter to a function? It's so annoying. |