Codeigniter gives a URL not foun - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, June 23, 2021

Codeigniter gives a URL not foun

im trying to do a simple click and go to another page but codeigniter is giving me ''NOT FOUND, The requested URL was not found on this server.''

Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/7.4.20 Server at localhost Port 80

My controller:

<?php

class Onekey extends MY_Controller {

   public function __construct(){
      parent::__construct();

     $this->load->model('Onekey_model'); 
    }

    public function index(){
       $this->render('onekey', 'Onekey_model');
    }

     public function teste(){
       $this->render('teste', 'Onekey_model');
}

HTML

    ````<form method="post" action="teste" class="login_form" accept-charset="utf-8">
        <button>Entrar</button></form>````

Htaccess

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

<IfModule !mod_rewrite.c>


ErrorDocument 404 /index.php
</IfModule>

Config file

$config['index_page'] = 'onekey';
$config['base_url'] = 'http://localhost/';

I have tried to use in the form action="onekey/teste" and still nothing

EDIT:

If i do action="index.php/onekey/teste" it works, so my problem is the index.php, how can i fix it?



source https://stackoverflow.com/questions/68084118/codeigniter-gives-a-url-not-foun

No comments:

Post a Comment