How to SEO URLs on Get form

Discussion in 'PHP' started by ojsimon, Oct 5, 2008.

  1. #1
    Hi
    I am trying to make a simple get form that asks the user to enter their name and then it returns their name on the next page, i have managed to do this but now i would like to have nice clean SEO Urls insted of the ugly get urls. How do i make do this?

    I am currently doing:
    Index.php
    <html>
    <form action="welcome.php" method="get">
    Name: <input type="text" name="name" />
    
    <input type="submit" />
    </form>
    </html>
    Code (markup):
    and

    welcome.php
    <html>
    Welcome <?php echo $_GET["name"]; ?>.<br />
    
    
    </html>
    Code (markup):
    So my question is how to make this have clean urls such as domain.com/'search-phrase'?

    Thanks
     
    ojsimon, Oct 5, 2008 IP
  2. risoknop

    risoknop Peon

    Messages:
    914
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    risoknop, Oct 5, 2008 IP
  3. ojsimon

    ojsimon Active Member

    Messages:
    459
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    i know that but how would you use it in this situation is what im asking?
     
    ojsimon, Oct 5, 2008 IP
  4. AT-XE

    AT-XE Peon

    Messages:
    676
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    add to the htaccess:

    RewriteEngine On
    RewriteRule welcome.php?name=(.*) $1

    Not tested however.
     
    AT-XE, Oct 5, 2008 IP