Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php $SERVER['PATH_INFO'] and apache mod_rewrite

Here I have .htaccess file with:

Options +FollowSymLinks

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php [QSA,L]

And rewriting works but there is no path_info in my index.php when I'm trying http://site.com/example .

I have red this topic https://stackoverflow.com/questions/1442854/codeigniter-problem-with-mod-rewrite-on-apache-1-3 but it didn't solve my problem.

So, this issue happens only on apache 1.3 (on 2.0 all is ok) and I wanna know why. I also unfortunately have no access to httpd.conf (

Please, help me.

like image 705
John Smith Avatar asked Oct 25 '25 20:10

John Smith


2 Answers

Try changing your rewrite rule to:

RewriteRule (.*) index.php [QSA,L,E=PATH_INFO:/$1]
like image 75
DaveRandom Avatar answered Oct 27 '25 11:10

DaveRandom


This is related to mod_negotiation and being able to access /index.php as /index (without the extension).

Solution:

a2dismod negotiation

service apache2 restart
like image 35
Tomasz Wasiluk Avatar answered Oct 27 '25 10:10

Tomasz Wasiluk