0

I already develop a system in windows base machine using xampp and codeIgnitor, So i change development environment to mac os 10.9 same system give me error 404. So putting index.php to the URL the issue fixed. But I wonder how it's happen. Cause I already remove index.php using htaccess file in windows environment. I want to know how I remove index.php in mac os 10.9.

This is my htaccess file content.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]

/Applications/XAMPP/xamppfiles/etc/httpd.conf File also edited as follows

  • enable rewrite module "LoadModule rewrite_module modules/mod_rewrite.so"
  • change username

    User ****** Group daemon

  • change permissions

    AllowOverride All Require all granted

CodeIgnitor config file also edited as follows

- change base url

    $config['base_url'] = 'http://localhost/ci2.2/';

 - Remove index.php

    $config['index_page'] = '';

 - Change URL Protocol

    $config['uri_protocol'] = 'AUTO';

I put my files in /Applications/XAMPP/xamppfiles/htdocs/ci2.2 directory

Cœur
  • 37,241
  • 25
  • 195
  • 267
nithin
  • 153
  • 15

2 Answers2

0

Try this htacess content:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Reference: http://ellislab.com/codeigniter/user-guide/general/urls.html

If you are using a subdirectory, replace the last line by this:

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

Replace [SUBDIRECTORY] by your the directory name

CMPS
  • 7,733
  • 4
  • 28
  • 53
  • Thanks Amir for quick response. I try it also. But not work. I assume the problem is htaceess not working in Mac os 10.9. Please guide me. Thanks again. – nithin Jun 28 '14 at 05:56
  • @nithin http://stackoverflow.com/questions/7941958/htaccess-rewriterule-not-working-correct-on-mac – CMPS Jun 28 '14 at 06:07
  • in that example localhost/~username/site/site/index.php/welcome and in my case localhost/ci2.2/index.php/welcome. So they say it work when used RewriteBase /~username/YOURPath . So I used RewriteBase /ci2.2 . But it not work for me :( – nithin Jun 28 '14 at 06:22
0

In my case following code works fine

 RewriteEngine On
 RewriteBase /projects/hc/homecare/trunk/homecare 
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond $1 !^(index\.php|images|robots\.txt|css|docs|js|system)
 RewriteRule ^(.*)$ /projects/hc/homecare/trunk/homecare/index.php?/$1 [L]

ref : link

Renish Gotecha
  • 2,232
  • 22
  • 21