![]() |
Problem with base_url() - 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: Problem with base_url() (/showthread.php?tid=73961) |
Problem with base_url() - TASOUNAyy - 06-29-2019 Hello guys, I'm working on a new project, and I got a real problem ( I didn't do codeigniter/php since a long time) I wan't to use base_url() in my view to redirect on another page, so i'm doing like this : <li class="nav-main-item"> <a class="nav-main-link" href="<?= base_url('formulaire/inscription')?>"> <span class="nav-main-link-name">Demande de compte</span> </a> </li> But it's not working, it's only working if I put index.php in first. In config.php I have: $config['base_url'] = 'http://localhost/multi/'; $config['index_page'] = ''; I tried to change my htacces but it's not working... Can you help me ? Thanks RE: Problem with base_url() - InsiteFX - 06-29-2019 You need to load the url_help, did you autoload the url_helper? RE: Problem with base_url() - TASOUNAyy - 06-29-2019 Forgot to say but yes I autoload url & url_helper. RE: Problem with base_url() - InsiteFX - 06-29-2019 Use CodeIgniters - anchor RE: Problem with base_url() - anthonykusuma - 06-29-2019 could you elaborate the changes that you made in the .htaccess file? If with index.php it's working, I believe the problem is in htacess. You can try this rewrite code on you .htaccess. Code: <IfModule mod_rewrite.c> RE: Problem with base_url() - TASOUNAyy - 06-30-2019 Currently I have this htaccess: RewriteEngine on RewriteBase/multi/ # Add www in the start of URL if user leave #RewriteCond %{HTTP_HOST} !^www\. #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Prevent CI index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L] # Prevent user access to the CI system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] # Prevent user access to the CI application folder RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] Still not working with your htaccess. With anchor I have this link : http://localhost/multi/formulaire/inscription. Not working. <?= anchor('formulaire/inscription', 'Inscription', 'class="nav-main-link"') ?> RE: Problem with base_url() - InsiteFX - 06-30-2019 You can try this one from FuelPHP has always worked for me. Code: <IfModule mod_rewrite.c> RE: Problem with base_url() - TASOUNAyy - 07-01-2019 When I use your htaccess @InsiteFX : Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. RE: Problem with base_url() - InsiteFX - 07-02-2019 It sounds like something is miss configured in your server. RE: Problem with base_url() - TASOUNAyy - 07-02-2019 I use wamp, rewrite module is enable. |