Jump to content

Query string from a form (GET method) to flat URL?


poleposters

Recommended Posts

Hi,

 

I was wondering if it was possible to generate a flat URL from a from using the method GET.

 

I've had some experience using mod-rewrite to create flat URLs from links

 

e.g

www.domain.com/blog/id/1 is interpreted as www.domain.com/blog.php?id=1

 

But how do I do it the other way around? ie. When I submit a form using the get method its going to generate a messy URL. Can I get the form to generate a flat URL?

 

I was afraid someone might mention javascript.

 

Mainly I'd like to make the URLs look clean and tidy and with any luck gain some advantage in SEO.

 

I just had an idea to use an intermediary page to process the form data and spit out a a flat URL to complete the query.

 

ie the form data  www.domain.com/blog.php?id=1 is passed to intermediate.php and  transfomed and redirected to www.domain/blog/id/1/ where the query is completed.

 

Are there any cons to this method?

 

 

im not entirely sure but i believe it is possible to do what you are trying to do with the .htaccess to any experts what I believe he means is he wants his links to look like this:

 

"www.domain/blog/id/1/"

 

instead of this:

 

"www.domain.com/blog.php?id=1"

 

-John

@Jnerocorp, your correct but i don't believe thats what his asking for ..

when you post from a form the URL the form goes to (VIA GET) is like index.php?id=10&name=blar,

 

Now while you can change the URL in an anchor tag, its not really possible to do it in a form.. but you could have a javascript collect all the form elements and build up a query and use

windows.locations= "page.php?"+buildUpQuery

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.