Solved

using url rewrites when posting a form

Posted on 2006-11-29
1
163 Views
Last Modified: 2010-03-04
if i have the form:
<form action="searchResults.php" method="get">
<input type="text" name="search" class="search" size="20" maxlength="50" title="Where Are You Looking To Go?? - Enter The Town Or Caravan Park" />
<input type="hidden" name="mode" value="quick"/>
                              
<input class="SubmitButton" type="submit" value="Search" class="submitbutton" name="submitbutton"/>
</form>

but i dont want the user or search engines to see the params, what is the best way to get a rewrite in??

im starting to get to grips with rewrites but this has got me slightly, do i need to post the data to one form which then forwards onto a url composed of the data and then catch that url which would be clean of any '?' or '&' etc.

so searchResults.php?search=tenby&mode=quick would be the url from the intial form, then in this form compose a url, mayb result-quick-tenby.htm

and then catch this address and post to the intial searchResults.php?........

but obviously the user or search engine wouldnt see this address, just the nice clean .htm url.

is this the best way to do this?
0
Comment
Question by:scm0sml
1 Comment
 
LVL 16

Accepted Solution

by:
HackneyCab earned 500 total points
ID: 18059436
If you don't want the user (or search robots) to see the query string in the URL, then your form should be using POST, not GET.

As for a tidy URL, if you wanted a request for /search/tenby.html to silently request /searchResults.php?search=tenby&mode=quick, then the following ought to work in a .htaccess file:

RewriteRule ^search/([a-zA-Z-]+)\.html /searchResults.php?search=$1&mode=quick
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Multiple SSL sites on one IP? 3 43
Best IDE for PHP starters 11 142
PHP Apache application gives "Forbidden" message 5 77
linux apache localhost dev laptop 5 53
In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question