CodeIgniter rewriting URL with FastCGI (PHP-FPM) returned 404

I got this issues some days ago, when my CI based apps returned 404 error when i accessing it. My machine is running Slackware with httpd + PHP-FPM. This issue is not appear when i used httpd/apache + mod_php.

This issue is like httpd's rewrite module is not enabled. But, i have made sure that that module had been activated. After searching and googling, I found solution from here.

From that article, we should be doing something tricky.

And this is my new .htaccess (edited from CI's .htaccess)

Options -Indexes
# index file can be index.php, home.php, default.php etc.
DirectoryIndex index.php

# Rewrite engine
RewriteEngine On

# condition with escaping special chars
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# the following is for rewritting under FastCGI
<IfModule mod_php5.c>   
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

# the following is for rewritting under FastCGI
<IfModule !mod_php5.c>   
    RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

From that code, the added script is apache define which module is activated, if use mod_php5, do rule --> RewriteRule ^(.*)$ index.php/$1 [L,QSA],
But if not used mod_php5 (using FastCGI), do rule -->RewriteRule ^(.*)$ index.php?/$1 [L,QSA].

The difference is just the "?" after index.php

Okay, thats all.

NB: I used -> CodeIgniter ver 3.0, HTTPD ver 2.4.23 and PHP-FPM ver 5.6.22

Komentar

  1. Blackjack Strategy Guide and How to Play - JTM Hub
    The easiest and 진주 출장안마 most common 창원 출장마사지 blackjack strategy is 서울특별 출장샵 the “strategy,” which is very similar to that used to play in 충청북도 출장샵 American casinos. The 서귀포 출장샵 strategy

    BalasHapus

Posting Komentar

Postingan populer dari blog ini

Bagian-Bagian Motherboard(Mainboard) dan Fungsinya

[Termux] Nginx sebagai Load Balancer dan Web Server

[Termux] Install NGINX dan PHP-FPM