httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Riccardo Cohen <>
Subject [users@httpd] moving from mod_php to mod_fcgid : rewrite problem
Date Tue, 05 Feb 2013 20:32:31 GMT
I'm new to apache mailing list, sorry if I'm not 100% clear, and sorry 
for this long description.

I have developped a website with php/mysql : and placed it on a good hosting 
service (
To improve search engine rank I decided to set all urls to 
/index.php/... and rewrite them to avoid having index.php in url (sort 
of MVC technique combined with SEO...)

Example : the catalog is at url :
This should be transparantly mapped to thanks to 
the rewrite rule :

RewriteRule ^en/(.*) ./index.php/en/$1

My application uses then $_SERVER["PATH_INFO"] (and not 
$_SERVER["QUERY_STRING"]) to retreive url information. This worked 
perfectly until last month, because changed the whole system 
and separated apache from php, using fast cgi instead of mod_php.

The system is supposed to be more reliable and more efficient like this, 
and apparently is. But the rewrite rule does not work anymore. So I 
investigated and made some test :

I have a small test.php that displays the path_info and query_string. 
You can presently test it here :

and I set the following rules :

RewriteRule ^test1/(.*) ./test.php/$1
RewriteRule ^test2/(.*) ./test.php?$1
RewriteRule ^test3/(.*) ./test.php?/$1
RewriteRule ^test4/(.*)$1

None of these 4 rewrite rules are convenient. Here is why :

- test1 : the system anwsers 404 "No input file specified". I think (not 
sure) that Apache beleives that test.php is a folder, and cannot find it 
so answers 404

- test2 : the rewrite rule works, but of course the url information is 
no more in path_info, it is in query_string as shown in the page content

- test3 : same as test2

- test4 : almost good, I can have the url info in path_info, but apache 
begins first with a 302 redirection and then changes the url to, which looses all 
search engine efficiency (and also eventual POST variables if any).

My host tried several searches on forums including this one, and could 
not find any answer. It seems to be an apache bug, but not sure, I have 
no bug number to give anyway. If it is a bug, it is demontrated by test1 
I think.

So here is my question : Is there any way to make this rewrite rule work 
in fastcgi mode, and what is the syntax for it, to keep info in 
path_info without 302 redirection. The Apache version is 2.2.23  and 
mod_fcgid is version 2.3.7 with configuration flag cgi.fix_pathinfo=1

If there is a way, thanks for your help I'd be glad to test it. If no 
could you explain why and how to solve it. As workaround we used test4 
syntax in the whole site, to make it work, but it is bad for search 
engine, and creates problem in backoffice (because certain backoffice 
functions use POST variables)

I know I can change my code to use query_string everywhere instead of 
path_info, but if I can avoid changing and testing all my websites it 
would be really great

Thanks a lot for your anwser.

Riccardo Cohen
+33 (0)6 09 83 64 49
1 rue de la Monnaie
37000 Tours


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message