-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 
Sparky
  • 98,165
  • 25
  • 199
  • 285
Abbbas khan
  • 306
  • 2
  • 15
  • 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 – mituw16 Jul 29 '16 at 14:24
  • **READ the manual:** [Remove `index.php` from the URL](http://www.codeigniter.com/user_guide/general/urls.html#removing-the-index-php-file) – Sparky Jul 29 '16 at 14:33
  • Possible duplicate of [How do I remove 'index.php' from URL in CodeIgniter?](http://stackoverflow.com/questions/2192136/how-do-i-remove-index-php-from-url-in-codeigniter) – Sparky Jul 29 '16 at 14:34

2 Answers2

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.

Daniel Waghorn
  • 2,997
  • 2
  • 20
  • 33
  • 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 – Abbbas khan Jul 29 '16 at 16:24
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