Results 1 to 4 of 4

Thread: urlrewrite virtual folders and form submit

  1. #1
    Join Date
    Aug 2006
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default urlrewrite virtual folders and form submit

    Hi,
    Im currently working on a project where I want to add virtual folders in some sections, for example:
    example.com/fake/topic-23.html
    <domain>/<fake folder>/<some topic with an id>
    however If I add a form to this topic-23.html page I will have to point it somewhere and even if I point it to /fake/ it will look like this:
    <domain>/<fake folder>/<my GET values>

    so is there some way I can urlrewrite the form submit action?
    for example if I want it to go here:
    example.com/fake/search/<search value>/topic-23.html

    // Dennis

  2. #2
    Join Date
    Sep 2008
    Posts
    56
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default

    Hi,

    I am assuming that your using PHP for this development on a Linux Server, there are two ways to do this: -

    a) Do URL parsing and redirecting in your .htaccess file, for this you will need to do some programing for apache and
    b) In your .htaccess define a specific PHP script and in this PHP script parse the query string and redirect to whatever page you want.

    I suggest the first one as it more friendly for search engine crawlers.

    Hope this helps.

    Cheers,

    ~Maneet
    LeXolution IT Services
    Web Development Company

  3. #3
    Join Date
    Aug 2006
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply, I didn't think about using the .htaccess file to redirect them.
    Btw lets say I have a page which is rewritten and says /topic/I_eat_pie-24.html

    won't I have to store the "fake" name in a hidden input field then?
    because all the .htaccess file will see is topic.php?id=24&search=<blabla>

  4. #4
    Join Date
    Aug 2006
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Scratch that last question, how can I even redirect someone with the htaccess file?
    I've been looking for ages for this but cant find anything usefull.
    I thought [R=301] would redirect them for good but that didn't work at all.
    example:
    Code:
    RewriteRule ^(search)/(.*)$ search.php?id=$2 [R=301,L]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •