Forum

Query String

RaGe10940
16 January 2014, 16:37
Hello Hugo,

I'm at the end of my wits (not that I have many) but I've exhausted all other possibilities, does Hiawatha by any chance not support query string in a php application? Like so :

https://www.learnlaravel.com/api/users?sEcho=1&iColumns=6&sColumns=&iDisplayStart=0&iDisplayLength=5&mDataProp_0=0&mDataProp_1=1&mDataProp_2=2&mDataProp_3=3&mDataProp_4=4&mDataProp_5=5&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&_=1389884846636

This is my re-write rule to remove the /index.php/ from my url :
UrlToolkit {
ToolkitID = laravel
RequestURI exists Return
Match .* Rewrite /index.php
}

Hiawatha version: (the latest)
Operating System: Lubuntu 13.10
RaGe10940
16 January 2014, 19:35
Hello Hugo,

I found the error.. its the re write rule that is causing this behavior.
UrlToolkit {
ToolkitID = laravel
RequestURI exists Return
Match .* Rewrite /index.php
}

why though? I don't understand? its only checking for index.php not the rest of the url?
Hugo Leisink
17 January 2014, 08:02
What your URL rewrite rule does is abort (return) when the requested URL exists. This can be a file or a directory. Otherwise, the URL will be rewritten to /index.php. However, the original URL can still be found in $_SERVER["REQUEST_URI"]. The URL parameters will be available in $_GET.
RaGe10940
17 January 2014, 08:10
I guess I'm just confused as to why the URLToolKit breaks the query string then? I removed the use of the url tool kit from the virtual host and the query string worked. I don't quite understand the reason though.
Hugo Leisink
17 January 2014, 10:51
What do you mean by 'breaks the query string'?
RaGe10940
17 January 2014, 14:22
Pretty much, when I was using the rewrite rule, the query string would return null. I then for some reason removed the url rewrite rule and the query string was able to be read all parameters passed in the query string worked just fine.
RaGe10940
17 January 2014, 15:27
From the rewrite rule, the part that is messing with my query string is : Match .* Rewrite /index.php

When I comment that out, I get my data to populate (the query string works) however the index.php is in the url

RaGe10940
17 January 2014, 15:49
Alright, the problem was indeed the.* Rewrite /index.php

so following the HOW TO I came up with this :
UrlToolkit {
ToolkitID = laravel
RequestURI exists Return
Match /(.*) Rewrite /index.php/$1
}

It matches everything before (/) like example.com/

then it everything after it rewrites to /index.php/(my URI)

so the outcome is example.com/index.php/(my URI)

pretty URLs and my query strings work fine now.

Thanks for the help!
This topic has been closed.