1

I am totally new to Code igniter and dealing with form submissions through MVC archi. As, I searched and tried all soultions and code given on stack overflow itself to remove index.php from url but all of them didn't worked. I know something is missing and I am not able to recognize it as I am new to CI.

This is my .htaccess code below,

<IfModule authz_core_module>
Require all denied
</IfModule>

<IfModule !authz_core_module>
Deny from all
</IfModule>

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

I have also set $config['index_page']=' '; and $config['uri_protocol']='REQUEST_URI'; in config.php file.

NOTE: My CI version is 3x

8
  • you're working on your local server? which OS? Commented Sep 8, 2017 at 5:01
  • yes i am working on win10 OS .. Commented Sep 8, 2017 at 5:07
  • check this : stackoverflow.com/questions/12272731/… Commented Sep 8, 2017 at 5:10
  • Your htaccess is not right Commented Sep 8, 2017 at 5:25
  • @AnandPandey any solution for that? Commented Sep 8, 2017 at 5:37

2 Answers 2

2

Make sure your rewrite base is right like given in screen shot i have given. There are many htaccess files in each folder. I give the htaccess which is in red in the image and the structure also.

enter image description here

 <IfModule mod_rewrite.c>
      RewriteEngine On
      # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
      #  slashes.
      # If your page resides at
      #  http://www.example.com/mypage/test1
      # then use
      # RewriteBase /projectfolder  //its an example

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

    <IfModule !mod_rewrite.c>
      # If we don't have mod_rewrite installed, all 404's
      # can be sent to index.php, and everything works as normal.
      # Submitted by: ElliotHaughin
      ErrorDocument 404 /index.php
    </IfModule>
Sign up to request clarification or add additional context in comments.

2 Comments

$config['base_url'] = 'localhost/project' in the application/config/config.php
Glad to help samrat bhai
1

I use xampp and windows 10

Place in main directory of project not in the application folder.

RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1

Structure

application
system
user_guide
.htaccess
index.php

Try some of these also

https://github.com/wolfgang1983/htaccess_for_codeigniter

Don't for get to set base_url

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

$config['index_page'] = '';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.