htaccess mod_rewrite conundrum
Posted
by
kelton52
on Server Fault
See other posts from Server Fault
or by kelton52
Published on 2012-06-25T20:29:10Z
Indexed on
2012/06/25
21:17 UTC
Read the original article
Hit count: 203
Ok, so I have this .htaccess file that contains this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php?p=%{REQUEST_URI}&%{QUERY_STRING} [L]
</IfModule>
Problem is, that in apache 2.2.22, the p
and the other query objects don't come through,
but it works great in apache 2.4.2 .
So basically in apache 2.2.22 it just forwards everything to index.php, but it doesn't have any get
objects.
Any help, thanks.
Update
Ok so I changed the line
RewriteRule . /index.php?p=%{REQUEST_URI}&%{QUERY_STRING} [L]
to
RewriteRule ^(.*) /index.php?p=$1 [L,QSA]
And now on apache 2.2.22 the p
GET doesn't go through, but any specific queries I add go through.
So If I do
http://localhost/index/fun/buns/funds?man=woman
on 2.4.2 I get
array (size=2)
'p' => string 'index/fun/buns/funds' (length=20)
'man' => string 'woman' (length=5)
and on 2.2.22 I get
array(1) {
["man"]=>
string(5) "woman"
}
To be clear What's happening on 2.4.2 is what I want, and 2.2.22 isn't cooperating.
Another Update Ok so it seems like what is happening is that when I do /index/whatever, it auto assumes index.php, and ignores that, it auto adds the .php to it, when I don't want it to. Any ideas on how to stop that?
© Server Fault or respective owner