0
RewriteEngine On
RewriteBase /

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

This is how I do in my .htaccess file, it's perfectly work on my local server

  • Windows 7
  • WampServer with PHP 5.5 Apache 2.4.9

http://api.app/facebook/show will show the correct result

But in my Linux server

  • PHP 5.4.39
  • Apache 2.2.3
  • CentOS 5.11

http://api.app/index.php/facebook/show I have to do this, how to fix it?

Suresh Kamrushi
  • 14,655
  • 12
  • 74
  • 87
Chan
  • 1,707
  • 5
  • 20
  • 36
  • Is rewrite module enable in apache config? – sachin Apr 15 '15 at 06:55
  • I just add in hosts file redirect to locahlhost, `127.0.0.1 api.app` – Chan Apr 15 '15 at 06:56
  • Yes, it's enable, otherwise `index.php/facebook/show ` won't work, because I don't have directory named `facebook/show`, it's from Controller – Chan Apr 15 '15 at 06:56
  • `index.php/facebook/show` will work even if it is disabled because there is no need of rewrite rules. Try removing `index.php` and see if it works. – sachin Apr 15 '15 at 07:04
  • of course it's not work, that's why I am here.... – Chan Apr 15 '15 at 07:08
  • Possible duplicate with http://stackoverflow.com/questions/14783666/codeigniter-htaccess-and-url-rewrite-issues – Kristiyan Apr 15 '15 at 07:09
  • Ok, check two things 1. rewrite module is enabled or not, 2. AllowOverride All for the directory. – sachin Apr 15 '15 at 07:10
  • After I open AllowOverride All in httpd.conf it's work, thak you very much – Chan Apr 15 '15 at 08:02

0 Answers0