0

I am working on project using codeigniter for the first time with bootstrap 3.

My application and system folder from CI is located outside my 'project.main' folder. Everything works fine until I try to use .htaccess in my project.

I am using an XAMPP server and I already loaded the rewrite module and as well as the AllowOverride All and restarted my server.
My url now looks like this 'http://localhost/project.main/' ..
Now my question is since I already removed the 'index.php', my navbar links in bootstrap was like this
'<a href='<?php echo site_url("pages/view/about"); ?>
but if I click it I am directed to the url
'http://localhost/project.main/pages/view/about' which gives me

Object not found' error page.

But if I use href=' <?php echo site_url("index.php/pages/view/about"); ?> I am routed to the right page. Which is the right way of doing it? and under my config.php I have this $config['uri_protocol'] = 'REQUEST_URI '; is it necessary that uri_protocol match what is on the .htaccess under RewriteCond %(REQUEST_URI)..?
What i read in github there are two versions of .htaccess.

mokNathal
  • 533
  • 1
  • 6
  • 20
threeFatCat
  • 840
  • 13
  • 30

1 Answers1

0

You didnt mention changing index page to blank inside config.php ? In case of emergency I give you my simple htaccess. It works when moving application and system folders out of public.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

Also try to switch uri_protocol option.

Here's the ultimate solution for index.php How to remove "index.php" in codeigniter's path .

Community
  • 1
  • 1
cssBlaster21895
  • 3,670
  • 20
  • 33
  • thank you for the response, yes i already set that. I tried several .htaccess setups and iam confuse which is which. So far these are some of the .htaccess i tried: https://gist.github.com/4226750 - and this is what i currently have, the first one. I just thought since i have two separate folders should i place the .htaccess in the main folder? or the folder that contains the system and application folders? – threeFatCat Sep 14 '15 at 13:44
  • Awesome! i tried that short code of yours and it works. Thank you! and the other mistake i had was i placed the .htaccess in the second folder. i already moved it in the first folder then. – threeFatCat Sep 14 '15 at 13:53