Kohana, .htaccess, and $_GET
Asked Answered
R

3

5

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?

Referendum answered 12/8, 2009 at 18:45 Comment(0)
S
8

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)

Stanislaw answered 12/8, 2009 at 18:51 Comment(1)
That worked. I'll wait and let others participate (since I know very little about .htaccess, and as such if this is the best solution) before I accept. Thank you!Referendum
N
1

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

Notional answered 12/8, 2009 at 18:50 Comment(0)
V
0

If you want to use standard practice and without query string you need to just follow these steps and it will work just like localhost And you need not change rewrite rules.

Go to your godaddy account file manager --> WebRoot directory --> Create php5.ini if it does not exist and place following line: cgi.fix_pathinfo = 1

Now you need to restart your Web Process:

1.) Log in to your Account Manager. 2.) Click Web Hosting. 3.) Next to the hosting account you want to use, click Launch. 4.) In the Stats & Monitors section, click System Processes. 5.) In the list on the left, click the process you want to view or click All Processes to view all processes at once. 6.) To end a process, click the corresponding end button on the toolbar.

Now you can use URI_PROTOCOL as Auto.

Vaticination answered 13/10, 2013 at 4:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.