Problem with base_url() |
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
Use CodeIgniters - anchor
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
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>
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"') ?>
You can try this one from FuelPHP has always worked for me.
Code: <IfModule mod_rewrite.c> What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
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.
It sounds like something is miss configured in your server.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |