4

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.

2
  • If you var_dump($_SERVER);, does anything contain what you want? In particular, what does $_SERVER['REQUEST_URI'] contain? Commented Dec 13, 2011 at 23:04
  • Yes, there is REQUEST_URI and I build my own path info from it. But I'm just trying to realize other decisions. Commented Dec 14, 2011 at 16:03

3 Answers 3

5

Try changing your rewrite rule to:

RewriteRule (.*) index.php [QSA,L,E=PATH_INFO:/$1]
Sign up to request clarification or add additional context in comments.

1 Comment

You just forgot the colon between PATH_INFO and /$1, of cause it crashes. I will quickly edit it...
1

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

Solution:

a2dismod negotiation

service apache2 restart

Comments

0

The PATH_INFO is a virtual path suffix after the real CGI executable / PHP script filename.
You need to pass one to see it:

RewriteRule (.*) index.php/$1 [QSA,L]

Note that you also might require the option to be enabled first: http://httpd.apache.org/docs/2.2/mod/core.html#acceptpathinfo

AcceptPathInfo On

And then depending on the PHP SAPI, you might have to configure the php.ini, regarding the --cgi-force-redirect setting (which is designed to eschew PATH_INFO exploits for some setups). http://php.net/manual/en/security.cgi-bin.php

1 Comment

I tried RewriteRule (.*) index.php/$1 [QSA,L] before, no success. AcceptPathInfo On - this option was added in apache 2 as I know, but my is 1.3 and I cannot upgrade it. If trying to go site.com/index.php/example - path info will appear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.