Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using url rewrites when posting a form

Posted on 2006-11-29
1
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
HackneyCab earned 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

610 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