Failed to delete index.php in WAMP with Codeigniter URL

I want to remove index.php in the URL, but it does not work. Here is what I did:

  • I enable rewrite_module in my Apache and then reboot the server
  • I am editing .htaccess in my codeigniter folder. I am adding this as per the example in the documentation.

    Rewriteengine on

    RewriteCond% {REQUEST_FILENAME}! -f

    RewriteCond% {REQUEST_FILENAME}! -d

    RewriteRule ^ (. *) $ Index.php / $ 1 [L]

  • Then I also delete index.php in app / config

  • Then I create a simple controller:

    class Users extends CI_Controller {
    
        public function __construct() {
            parent::__construct();
        }
    
        public function index() {
            echo "hello world";
        }
    
    }
    

And when I access this url:

http://localhost/order_menu/users

I got this error:

Not Found

The requested URL /order_menu/users was not found on this server.

Can you help me?

+4
source share
1 answer

Removing index.php in the encoder on the wamp apache server!

wamp, , Apache Modules "rewrite_module"

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]

application/config/config.php

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

index.php blank

$config['index_page'] = '';

.

CI3: http://www.codeigniter.com/user_guide/general/routing.html

CI2: http://www.codeigniter.com/userguide2/general/routing.html

+5

Source: https://habr.com/ru/post/1607372/


All Articles