-1

my codeigniter project in mathwork folder mathwork is folder inside a another folder admin which have codeigniter file admin admin is folder have a codeigniter file library all have

 mathwork
   --admin

when i want to try access as

http://localhost/mathwork/admin/authorize/add 

it show error 404

when i try to access as

http://localhost/mathwork/admin/index.php/authorize/add

its working fine

how to remove index.php and get url as

 http://localhost/mathwork/admin/authorize/add 
3
  • you need to enable url rewriting in your webserver and configure it through your web.config (IIS) or .htaccess (apache) or whatever config your webserver uses Commented Jul 29, 2016 at 14:24
  • READ the manual: Remove index.php from the URL Commented Jul 29, 2016 at 14:33
  • Possible duplicate of How do I remove 'index.php' from URL in CodeIgniter? Commented Jul 29, 2016 at 14:34

2 Answers 2

0

I use wamp and xampp and windows 10

This .htaccess seems to work fine for me

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]

Place the htaccess out side of application folder

  • yourproject
  • yourproject > admin <-- application folder
  • yourproject > admin > .htaccess
  • yourproject > admin > index.php you may need to change the system ../system

  • yourproject
  • yourproject > frontend <-- application folder
  • yourproject > system
  • yourproject > .htaccess
  • yourproject > index.php

On config.php

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

You can get more .htaccess here

Sign up to request clarification or add additional context in comments.

Comments

0

Create a file called .htaccess (if Apache) in the same directory as your index.php, open it and add this:

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

Next open config.php and change $config['index_page'] = "index.php" to $config['index_page'] = "".

Your URLs should now work without index.php in the address bar.

1 Comment

does not work for me i do as you write here but does not work codeigniter file is in mathwork folder and inside mathwork folder have admin folder in this folder have codeiniter file and i'm using REQUEST_URI

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.