Solved

using url rewrites when posting a form

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

690 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