Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kohana, .htaccess, and $_GET

After uploading my Kohana project to my Godaddy server, I noticed my standard .htaccess file wasn't working sufficiently to provide the clean URLs. After some guidance, I ended up with the following rule:

RewriteRule .* index.php?kohana_uri=$0 [PT,L]

This got my nice-URLs working again, but today I find out that it may be breaking my internal search-engine, which also uses GET-style variables:

/search?terms=php

The values aren't being found by the scripts. They are on my development-server which doesn't have the modified RewriteRule, but not on the Godaddy server which does use the RewriteRule.

Am I right in assuming that rule is breaking any scripts ability to read from $_GET, and if so how can I remedy this?

like image 938
Sampson Avatar asked Aug 12 '09 18:08

Sampson


2 Answers

Maybe using QSA in your rewriterules, like this :

RewriteRule .* index.php?kohana_uri=$0 [PT,QSA,L]

See the manual of mod_rewrite (quoting) :

'qsappend|QSA' (query string append)

This flag forces the rewrite engine to append a query string part of the substitution string to the existing string, instead of replacing it. Use this when you want to add more data to the query string via a rewrite rule.

Might help (not tested in your particular case, but I remember have used this some time ago, for some kind of problem like this one)

like image 151
Pascal MARTIN Avatar answered Oct 23 '22 09:10

Pascal MARTIN


I think you could add: RewriteCond $1 !^(search), or a variation of such.

like image 45
arbales Avatar answered Oct 23 '22 09:10

arbales