PHP - codeigniter URL not working without index.php - object not found

codeigniter htaccess remove index.php not working
how to remove index.php from codeigniter url in localhost

I am using codeigniter v3 for my website and I'm having problems redirecting from one page to another.

If I click the tab, the link shows localhost:8080/IDS/view/decisiontree and shows Object not found! The requested URL was not found on this server...

If I edit the URL and make it localhost:8080/IDS/index.php/view/decisiontree, the site perfectly loads.

Here are my routes:

$route['view/decisiontree'] = 'data_controller/goto_decisiontree';

Here are the codes of the tab related:

<li><a href="<?php echo base_url();?>view/decisiontree">Decision Tree</a></li>

Here is my data_controller:

public function goto_decisiontree(){
    $data['page'] = "2";

    $this->load->view('decisiontree_page', $data);
}

And here is my config.php:

$config['base_url'] = 'http://localhost:8080/IDS';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

Here's my .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

And note, I'm using Codeigniter V3.

Thanks a lot for the help!


Try the following

Open config.php and do following replaces

$config['index_page'] = "index.php"

to

$config['index_page'] = ""

In some cases the default setting for uri_protocol does not work properly. Just replace

$config['uri_protocol'] ="AUTO"

by

$config['uri_protocol'] = "REQUEST_URI"

HTACCESS

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

Hope it helps .

The requested URL was not found on this server, The requested URL was not found on this server. Offline johancelis I had to change a few settings to make it run locally such as the base_url. i think in your config.php file your base_url should be like index.php?/$1 [L  codeigniter not working without index.php in url. if index.php is not in the url, the project breaks and I see a 404 error: The requested URL was not found on


Try this htaccess in main directory of your codeIgniter project. It seems to work fine in xampp and wamp.

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]

config.php

$config['base_url'] = 'http://localhost:8080/IDS/';
$config['index_page'] = "";
$config['uri_protocol'] = 'REQUEST_URI';

All ways remember that you should have first letter of file name and class as upper case the rest lower case. refer

More htaccess examples here

Object not found, controllers/member_area.php. PHP Code: function index(){ The requested URL was not found on this server. The link It seems your .htaccess is not working correctly. Except that I do not know how to do (Step no. 1): Step-2 : Go ahead and add some htaccess rules inside root folder htaccess file. Open your root .htaccess file if there is no file then create a .htaccess file on your root directory and place the below htaccess rewrite rules inside your project htaccess file for codeigniter remove index.php.


Note: I'm on Ubuntu, so the paths here may change if you are on another distro.

I tried all .htaccess suggestions and none seemed to work, so I started thinking that was not the problem. And then it hit me, the apache.conf file. Doesn't matter the .htaccess you have, if that file is restricting the override, there's nothing you can do.

So i went to /etc/apache2/ and edited the apache2.conf file adding this:

<Directory /var/www/html/your-project-folder>
    AllowOverride All
    Require all granted
</Directory>

Also change $config['index_page'] = index; to $config['index_page'] = ''; in application/config/config.php as said above.

Btw, my .htaccess looks like this:

RewriteEngine On
RewriteRule ^(application) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

And don't forget to restart apache.

Requested URL was not found on this server, Chat with fellow EECMS users in the 'Requested URL was not found on Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> Running Multiple Applications with one CodeIgniter Installation .com/​codeigniter/user-guide/general/managing_apps.html</a> | | | NO TRAILING SLASH! If you find that no matter what you put in your URL only your default page is loading, it might be that your server does not support the REQUEST_URI variable needed to serve search-engine friendly URLs. As a first step, open your app/Config/App.php file and look for the URI Protocol information. It will recommend that you try a couple of


Please try to set the index_page blank in config.php file

$config['index_page']= "";

Also please change the .htaccess file:

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

Hiding PHP - Manual, So far I haven't seen a working rewriter of /foo/bar into /foo/bar.php, so I created my own. lets you hide/omit .php in the url without any rewriting, etc. As the manual indicates, obscurity is not security. Typing "sub.domain.foo/anything" loads "/anything/index.php" if 'anything' is a directory, else it loads "/anything.php"​. As CodeIgniter’s URLs are designed to be search engine friendly and to human too. And so to maintain the standards we need to remove the default index.php which appears in the url of codeigniter applications, so that the url becomes search engine friendly and looks clean.


How to remove index.php from URL in CodeIgniter? Edureka, index.php file will be included in the URL by default. CodeIgniter is a free, open​-source, easy-to-use, object-oriented PHP web application But in a few cases, it may happen that the default setting for url_protocol does not work properly. If you found this PHP Tutorial blog relevant, check out the PHP  By default, the index.php file will be included in your URLs: example . com / index . php / news / article / my_article If your Apache server has mod_rewrite enabled, you can easily remove this file by using a .htaccess file with some simple rules.


CodeIgniter .htaccess file · GitHub, #Additionally this will allow you to create a System.php controller,. #previously ErrorDocument 404 /index.php. </IfModule> Please. Object not found! The requested URL was not found on this server. You solved a huge problem of mine. Removing index.php file. Open the config.php file in your text editor and remove index.php from here. Change: 1. $config ['index_page'] = "index.php"; To: 1. $config ['index_page'] = ''; But in a few cases, it may happen that the default setting for url_protocol does not work properly.


404 Page Not Found The page you requested was not found , I have a codeigniter which works very fine on a local machine. Below is my config.php file showing the base url of my application: work, try. Without .​htaccess file; Check the logs; Set php error_reporting(-1); and Add echo __​FILE__; die; to the second line of index.php to make sure it is being called. Questions: In my web application using codeigniter. I am trying to use base_url() function but it shows empty results. I have also used autoload helper through autoload file, but then too it doesn’t seem to work.