473,378 Members | 1,500 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

filename without extension in URL query

If I have a search submit button, when I click submit button, it will
submit the form to search.asp for form processing.
This will be the URL: http://www.mycompany.com/search.asp?q=programming

But when I do search in google, search doesn't have any file extension.
How do they do that? I saw some site are like that too.
http://www.google.com/search?hl=en&q...=Google+Search

Please advise. thanks!!

Jul 17 '05 #1
6 2042
On Thu, 03 Feb 2005 21:20:08 -0800, jrefactors wrote:
If I have a search submit button, when I click submit button, it will
submit the form to search.asp for form processing. This will be the URL:
http://www.mycompany.com/search.asp?q=programming

But when I do search in google, search doesn't have any file extension.
How do they do that? I saw some site are like that too.
http://www.google.com/search?hl=en&q...=Google+Search

Please advise. thanks!!


If you're using Apache, look into the ScriptAlias directive. This
configuration option tells the webserver that everything under a certain
URL are to be handled by CGI (ie execute those files and send the result
to the browser). Most often, directories are listed, but individual files
can be specified.

HTH,
La'ie Techie

Jul 17 '05 #2
jr********@hotmail.com wrote:

[snip]
But when I do search in google, search doesn't have any file extension.
How do they do that? I saw some site are like that too.
http://www.google.com/search?hl=en&q...=Google+Search


With Apache, you can the MultiViews directory option and content
negotiation. If a given filename can't be found, the module will look
for files that begin with whatever name was specified.

Clearly, content negotiation is meant for choosing between multiple
options based on some criteria like media type or language, but it
still works with only one choice of file.

See <URL:http://httpd.apache.org/docs-2.0/content-negotiation.html>.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 17 '05 #3
Followups to c.l.php.

An anonymous being wrote:
If I have a search submit button, when I click submit button, it will
submit the form to search.asp for form processing.
This will be the URL: http://www.mycompany.com/search.asp?q=programming
Not a terrible URI; in fact the only questionable part is
the '.asp', which you want to remove anyway.
But when I do search in google, search doesn't have any file extension.
As a rule, URI suffixes like '.asp' are redundant and serve
only to advance link rot, and so should not be present in
URIs. The exceptions are few and far between.
How do they do that?


No idea; if you really want to know how they do it, you'd
better ask them. There are various approaches, but with
Apache, your best bet is probably MultiViews, which you will
likely need to enable.

http://httpd.apache.org/docs/content-negotiation.html

--
Jock
Jul 17 '05 #4
Hi,

What you can also do is, for example you have the file :
http://www.mydomain.com/directory/index.asp?value=1

You could (if your webserver is setup to display index.asp as default (or
defaul.asp)) call this by :
http://www.mydomain.com/directory/?value=1

Maybe that's what your looking for.

Good luck!
--
Posted by news://news.nb.nu
Jul 17 '05 #5
<jr********@hotmail.com> wrote:
If I have a search submit button, when I click submit button, it will
submit the form to search.asp for form processing.
This will be the URL: http://www.mycompany.com/search.asp?q=programming

But when I do search in google, search doesn't have any file extension.
How do they do that? I saw some site are like that too.
http://www.google.com/search?hl=en&q...=Google+Search


Since you cross-posted this to a Java newsgroup as well, I'll give you
the answer in Java servlets. Followups set.

When you map a servlet to a URI, you do so with a <servlet-mapping>
element in WEB-INF/web.xml. That URI pattern can have a number of
different forms (including various uses of wildcards), but you can very
easily write:

<servlet-mapping>
<servlet-name>my_servlet</servlet-name>
<url-pattern>/search</url-pattern>
</servlet-mapping>

If you're using a JSP, then it's a little more complicated. In general,
though, JSPs should never be the direct targets of requests from
browsers. It's far more flexible to handle HTTP requests with a
servlet, and then use RequestDispatcher to forward to the appropriate
JSP file depending on how you wish to respond. That even leaves you the
flexibility to avoid a JSP entirely; for example, if you need to
generate an image, or build an extremely dynamic page programmatically
with Apache ECS, or something of that sort.

If you insist on using JSPs to handle browser requests directly, then
you would either need to add a servlet mapping for the JSP servlet to
web.xml (generally, the JSP servlet is called "jsp", but I'm not sure
off-hand whether that is specified or container-specific), or you could
use any of the same techniques mentioned by the PHP folks already, with
an Apache front-end.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Jul 17 '05 #6
jr********@hotmail.com wrote:
If I have a search submit button, when I click submit button, it will
submit the form to search.asp for form processing.
This will be the URL: http://www.mycompany.com/search.asp?q=programming
But when I do search in google, search doesn't have any file extension. How do they do that? I saw some site are like that too.
http://www.google.com/search?hl=en&q...=Google+Search


These previous discussions may help you some.

1.
<http://groups.google.com/gr*****************************************@postin g.google.com>
2.
<http://groups.google.com/gr*****************************************@postin g.google.com>

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Martin Lucas-Smith | last post by:
Is there some way of using ereg to detect when certain filename extensions are supplied and to return false if so, WITHOUT using the ! operator before ereg () ? I have an API that allows as an...
1
by: hokiegal99 | last post by:
I've written a small script (with much help from this list) that searches through a directory for files without a PC filename extension like .doc .xls and then adds them. The reason for writing the...
6
by: Joe | last post by:
If I have a search submit button, when I click submit button, it will submit the form to search.asp for form processing. This will be the URL: http://www.mycompany.com/search.asp?q=programming ...
27
by: gmtonyhoyt | last post by:
I need assistance coming up with a clean way to handle filename extensions with my application. While I can come up with several ways of doing so on my own, I felt perhaps it would be worth...
2
by: Csharper95 | last post by:
I want to get the file name and path from a SaveFileDialog (for a 'save as' operation) after the user has saved the information under a new file name (and presumably under a new path) ? I want...
4
by: Jed | last post by:
I have looked everywhere and cannot find a resolution for this. I have read several post on this forum that allude to similar issues but I have not found a solution. I am sending dynamic...
10
by: Brian Gruber | last post by:
Hi, I'm looking for a way to rename a whole directory of files in short order. The files in the directory have different lengths, however all of them end with _xxxx the x's represent a randomly...
8
by: Lad | last post by:
Hello, what is a way to get the the extension of a filename from the path? E.g., on my XP windows the path can be C:\Pictures\MyDocs\test.txt and I would like to get the the extension of the...
8
by: gopal | last post by:
Hi, I would like to display only the file names in SaveFileDialog control when i open it the Window in the without the complete file path Example if the file - -- test.doc is in folder...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.