doubts about clean URL without mod_rewrite

2

I have a small project to do in the next few days and my client has a cheap, shared hosting that does not allow me to change apache settings and is not mod_rewrite enabled. I would like to find another way to keep URLs friendly and I'm thinking of architecting an environment where:

http://www.meucliente.com/action/param1/param2/

is replaced by:

http://www.meucliente.com/?/action/param1/param2/

Notice the question mark before /action .

From this, index.php will read the superglobal $_SERVER['QUERY_STRING'] to decide what to do. Even a form with POST would be sent to an address that looks like GET

<form action="/?/form-action/" method="POST">...</form>

Here comes the real question: in your opinion, dear experienced developers, does this look a lot like gambiarra? is there another more elegant way to make the url friendly without apache's mod_rewrite?

    
asked by anonymous 09.12.2015 / 15:44

1 answer

0

This is a valid technique for cases where URL rewriting is not available, either through Apache, Nginx, IIS or any other server.

This is called a "fake friendly url". Or "fake mod_rewrite". Finally, there is no "official" term. You will usually find information about the subject if you search for these terms.

Another way to do this is

http://www.foo.bar/index.php/action/param1/param2/

In fact, it's the same as using the way you presented in the question, using empty argument parameter.

Not everything that is done with gambiarras represents something bad or amateur.

Popular frameworks have support for this gambiarra as well. There are gambiarras that are useful and good and this one sure is good and useful

However, applying a friendly URL when submitting a POST request does not make sense.

    
09.12.2015 / 15:59