Solved

using url rewrites when posting a form

Posted on 2006-11-29
1
157 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now