0

Here is my .htaccess file. My xampp installation is located on my E drive. I put the .htaccess file in my htdocs in E:\xampp\htdocs\.htaccess.

RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
# Remove www from any URLs that have them:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://mobiloka.com/$1 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END 

I also changed the config.php in Codeigniter to:

$config['index_page'] = '';

I have tried both:

$config['uri_protocol'] = 'AUTO';
$config['uri_protocol'] = 'REQUEST_URI';

Every time I try to navigate to another page on my site it runs into the dashboard. What should I do to make it able to access my site in localhost without index.php?

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
  • Possible duplicate of [CodeIgniter removing index.php from url](http://stackoverflow.com/questions/19183311/codeigniter-removing-index-php-from-url) – Mayank Vadiya Feb 25 '16 at 04:29

1 Answers1

0

It looks like your using codeIgniter 2 versions

If your using CodeIgniter 3 for the uri_protocol Auto has been removed.

Try using this htaccess for xampp. And place it in main directory of your project. Out side of the application folder.

htdocs / 
  your_codeigniter_project_folder / 
  your_codeigniter_project_folder /  application_folder /
  your_codeigniter_project_folder / system_folder /
  your_codeigniter_project_folder / .htaccess
  your_codeigniter_project_folder / index.php

.htaccess

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

And on config.php

$config['base_url'] = 'http://localhost/your_project_name/';
$config['index_page'] = '';
  • Thank you for your answer. Unfortunately it still goes to localhost/dashboard :( – Nouzar Wijaya Feb 24 '16 at 21:40
  • @NouzarWijaya try some of these htaccess https://github.com/riwakawebsitedesigns/htaccess_for_codeigniter –  Feb 24 '16 at 23:04
  • @NouzarWijaya On your `E:\xampp\htdocs.htaccess.` it looks like you have it straight in the htdocs folder and not in your project folder I have updated my answer. –  Feb 25 '16 at 02:17
  • Make sure all your class and file names have first letter upper case for controllers and models. –  Feb 25 '16 at 20:07