I tested my site many times but I am not able to resolve Page not found error. well,
1 step: I create one controller and called welcomelogin.php - where I store two functions
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class WelcomeLogin extends CI_Controller {
public function index()
{
$this->home();
}
public function home(){
$this->load->helper('url');
$this->load->view('login');
}
public function inside(){
$this->load->helper('url');
$this->load->view('inside');
}
2- step: In my rote.php file I simple perform follwing:
$route['default_controller'] = "welcomeLogin";
$route['404_override'] = '';
3- step: Inside view folder I create two files one is login.php & second is inside.php with login.php contains login form and inside.php contain simple html.
Now I got login page as home page of my website which is working fine: http://localhost/website/Codeigniter_Project/MyProject/
When I do following I get page not found error: I tried with two ways and both gives me same error:
1-st way: by direct giving view name and result page not found localhost/website/Codeigniter_Project/MyProject/inside
2-nd way: by giving controller name and then view but result page not found localhost/website/Codeigniter_Project/MyProject/welcomelogin(controllername)/inside
Please help me as I spend almost 2 hours by searching and applying different answers and yes there are similar questions on stack and some have answer which I already tried but didn't work & those question is bit different then mine. Thanks for your time guys.:) I am running on localhost server and my apache mod_rewrite is on. thanks. & I am new to codeigniter thanks
My .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /website/Codeigniter_Project/MyProject/
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [L,R=301]
# Enforce NO www
#RewriteCond %{HTTP_HOST} ^www [NC]
#RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
###
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>