DaGhostman Dimitrov
DaGhostman Dimitrov

Reputation: 1626

Removing query string affecting php $_GET

I was looking for a way to remove the query string entirely to make sure the URLs are nice and tidy as much as possible, but I found this forum post and it says that it will not be useful

then those query string pages will not be accessible

In my application I am forming my URLs like this:

example.com/module/controller/action/arg1/value1/../..

Where arg1 and value1 are NOT a masked query string representation, they are other specific keys for the request.

EDIT:

I am re-routing all requests going to the application, that do not exists as file and/or folders (couldn't think of better way to say it) to my index.php, which is the entry point of my application. From there the application parses the directory part and does the routing internally(using the $_SERVER['REQUEST_URI'], not that I am not looking for alternative way in doing this I know I could use the parse_url(); function).

When I have URL like this:

example.com/module/controller/action/arg1/value1?get_arg1=value1&get_arg2=value2

the value1 gets buggy and the URLs are way too ugly in my standarts :)

Upvotes: 0

Views: 98

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799110

  • So my general question is will this affect PHP's $_GET variable in some way?

  • Is it possible to have any problems with the structure mentioned above when I remove the query string?

The forum poster wants to remove the query string and all traces of data passed to the page completely. This is a bad idea since their site will no longer work.

What you are proposing takes what was normally in the query string and puts it into the path info instead. This is acceptable provided you 1) use a URL rewriter to change the path info back into a query string on the server-side, or 2) modify your code to use the path info instead.

Upvotes: 1

Related Questions