SEO friendly urls after submiting a form

What means that?
It means that in a form whit GET method, when you submit, you will be redirected to a new page with “?example=variable” added to the URL.
Think if your users will search on your site some data and wish to place the link with the searched results on blogs,forum will have an ugly URL,but the most of all you will lose characters spaces for more keywords for SEO.
Here is an example:
This is a default form submitted url:

And a pretty one:

In the last example your link has 24 characters more used for keywords in the same length the preview has.
How can we do this?Simple.
We will use forms with POST methos.This will send data via POST to a page where it will be redirected to a new location ,the URL rewrited.

<form method=”post>
<input name=”data” type=”text” >
<input type=”submit” >

The php script should contain on the firs line this:

if (isset($_POST['data']) && $_POST['data']!= ”) {
header( ‘Location:”/[^a-zA-Z0-9s ]/”, “-”, $_POST['data'])-s;

and the .htaccess file should contain between the lines this(if you have an wordpress do not use this method)

RewriteRule ^([a-zA-Z0-9]+)-s$ redirected-page.php?data=$1

This is all.
Redirected-page.php is the page where you get the requests and show the results.

Place a link to your site with refference to this article,if you want to use this post!!

Link To This Post
1. Click inside the codebox
2. Right-Click then Copy
3. Paste the HTML code into your webpage
  • Share/Save/Bookmark

Related posts:

  1. SEO Friendly URL with Mod Rewrite from Apache

6 Responses to “SEO friendly urls after submiting a form”

  1. Anonymous  on May 31st, 2009

    ммм )) симпотичный blog =)
    не хотел случайно сменить дизайн? Поставить ещё пару плагинов от спамераи будет красивее..ну это вот это будет красиво действительно :)
    Кстати , ты какой хоcTuHg юзаешь? =)

  2. Seo Tools  on June 1st, 2009

    Thanks for sharing this informative post with us . I think many people looking for this like me.

  3. Seo Tips  on June 5th, 2009

    yes! do you speak english? :)

  4. JaneRadriges  on June 14th, 2009

    Hi, gr8 post thanks for posting. Information is useful!

  5. Rob  on August 16th, 2009

    Thanks, i used the regular expression for another site i am working on, but im not sure of any SEO benefit as search engines dont submit forms, although if you have direct links on a site to a specific search then i guess there is some SEO benefit of using it there. All in all, useful post none the less.

  6. Ana D  on September 22nd, 2009

    Great post! Have been wondering how to do this. Thanks for the information.

Leave a Reply