views:

289

answers:

2

I enabled URL rewriting on my PHP site with Apache (http://example.com/index.php?param=12 becomes http://example.com/index/param/12).

I have a few forms which are in GET instead of POST.

After subitting the form, the resulting URL is not rewritten.

Is it possibile to keep rewritten URLs after submitting a GET form?

UPDATE: I found this article on the topic http://matthewjamestaylor.com/blog/how-to-post-forms-to-clean-rewritten-urls but I really don't like the idea of redirecting to rewritten URL. Is there really no way to keep rewritten URLs without redirecting?

UPDATE 2: Here is an example of what I'm trying to do. Let's say I have a simple form like this:

<form method="get" action="">
   <fieldset>
      <input type="text" name="q" />
      <input type="submit" value="Search" />
   </fieldset>
</form>

and let's say my url is http://example.com/index/param/12

After submitting the GET form, the url becomes http://example.com/index/param/12?q=my-input-text, while I would like to get a rewritten url like http://example.com/index/param/12/q/my-input-text

A: 

apache mod_rewrite only processes incoming (request) urls - it has no control of the urls you generate in your php scripts. This is something you should take care of yourself.

stereofrog
+2  A: 

Seems like if you want your form to go directly to /q/my-input-text you should use JavaScript to make that happen on the form's onSubmit.

philfreo