473,386 Members | 1,830 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,386 software developers and data experts.

Avoiding empty parameters in URL and more

Is there any way I can keep those URLs...
www.example.com/?q=hello&type=

from appearing? Let's say I have a form with a select-options box.
Along with a single text-input. Now if "q" is the name of the input box
and "type" is the name of the select-box, I also have a default for
type (which is empty and does nothing). Do I need to have htaccess
redirects to clean above URL to this one:

www.example.com/?q=hello

On a side-note: is there anything bad about /?q=hello, where the longer
version would be /index.php?q=hello ? I do not want to code my
scripting file extension into the URL. I want the URl to live longer
than my choice of scripting language, besides I want it to be as short
and easy-to-read (and pass on) as possible. Any ideas?
Jul 20 '05 #1
6 3073
"Philipp Lenssen" <in**@outer-court.com> wrote:
Is there any way I can keep those URLs...
www.example.com/?q=hello&type=

from appearing?
Ummm... stop creating them? But what is your problem with them?
Let's say I have a form with a select-options box.
Along with a single text-input. Now if "q" is the name of the input
box and "type" is the name of the select-box, I also have a default
for type (which is empty and does nothing).
Yes, what is the problem?
Do I need to have
htaccess redirects to clean above URL to this one:

www.example.com/?q=hello
Why would you need to do that? Your server-side form handler should
simply deal with what it gets, and be prepared to literally anything.
It can check for a field named "q" and simply ignore anything else, if
you like.
On a side-note: is there anything bad about /?q=hello, where the
longer version would be /index.php?q=hello ?


Of course not, as long as your server deals with it. If it internally
treats http://www.example.com/ as mapped to
http://www.example.com/index.php, everything works fine.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #2
On 6 Feb 2004 15:01:37 GMT, "Philipp Lenssen" <in**@outer-court.com>
wrote:
Is there any way I can keep those URLs...
www.example.com/?q=hello&type=
from appearing?


No. Even if you stop creating them, there's nothing to stop me (as a
user) from hand-typing them into my browser.

Make your server deal with them. Do something sensible if it's given
garbage.

This is one instance of the principle "Be tight when producing data,
be loose when accepting it". It works equally well when applied to
URLs.

--
Die Gotterspammerung - Junkmail of the Gods
Jul 20 '05 #3
Jukka K. Korpela wrote:
"Philipp Lenssen" <in**@outer-court.com> wrote:
Is there any way I can keep those URLs...
www.example.com/?q=hello&type=

from appearing?


Ummm... stop creating them? But what is your problem with them?


The problem is minor: I want to have a highly readable URL and above
could be slightly more readable.

E.g. the following URL is a Google Groups search for "test":

<http://groups.google.com/groups?hl=e...-8&safe=off&q=
test&sa=N&tab=wg>

It looks fine, but when I copy it to link to it (on my website, in
email, newsgroup) I don't feel comfortable because it seems to contain
garbage, and possibly garbage exposing something like my user-id or
settings or whatever.

E.g. clicking on the first link I am referred to the even worse:

<http://groups.google.com/groups?q=te...&oe=UTF-8&safe
=off&selm=fr.chartes.test-1075935661.719681%40calva.glou.org&rnum=1>

So I'm just thinking about how to make my URLs as simple as possible.
That's all.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #4
Andy Dingley wrote:
On 6 Feb 2004 15:01:37 GMT, "Philipp Lenssen" <in**@outer-court.com>
wrote:
Is there any way I can keep those URLs...
www.example.com/?q=hello&type=
from appearing?


No. Even if you stop creating them, there's nothing to stop me (as a
user) from hand-typing them into my browser.

Make your server deal with them. Do something sensible if it's given
garbage.


I don't have problems accepting the data, in fact it'd be just empty
anyway, I just want the URL to be as simple as possible for users
copying it. Often I create the following thing from above:

www.example.com/hellp/type-x/

So I find this easier to get for users, search engines, etc.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #5
In article <c0*************@ID-203055.news.uni-berlin.de>,
"Philipp Lenssen" <in**@outer-court.com> wrote:
Is there any way I can keep those URLs...
www.example.com/?q=hello&type=

from appearing?
Ummm... stop creating them? But what is your problem with them?


The problem is minor: I want to have a highly readable URL and above
could be slightly more readable.

E.g. the following URL is a Google Groups search for "test":

<http://groups.google.com/groups?hl=e...-8&safe=off&q=
test&sa=N&tab=wg>


Can be rewritten as <http://groups.google.com/groups?q=test>.

It looks fine, but when I copy it to link to it (on my website, in
email, newsgroup) I don't feel comfortable because it seems to contain
garbage, and possibly garbage exposing something like my user-id or
settings or whatever.

E.g. clicking on the first link I am referred to the even worse:

<http://groups.google.com/groups?q=te...&oe=UTF-8&safe
=off&selm=fr.chartes.test-1075935661.719681%40calva.glou.org&rnum=1>

So I'm just thinking about how to make my URLs as simple as possible.
That's all.


Maybe this will spark inspiration:
<http://www.alistapart.com/articles/succeed/>

--
Kris
<kr*******@xs4all.netherlands> (nl)
<http://www.cinnamon.nl/>
Jul 20 '05 #6
Kris wrote:
In article <c0*************@ID-203055.news.uni-berlin.de>,
"Philipp Lenssen" <in**@outer-court.com> wrote:

E.g. the following URL is a Google Groups search for "test":

<http://groups.google.com/groups?hl=e...=UTF-8&safe=of
f&q= test&sa=N&tab=wg>


Can be rewritten as <http://groups.google.com/groups?q=test>.


I know. You know. But most people either don't know or are too lazy.

Maybe this will spark inspiration:
<http://www.alistapart.com/articles/succeed/>


Thanks!

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #7

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

Similar topics

10
by: Nick Craig-Wood | last post by:
I'm trying to avoid using shell metacharacters in os.popen in a portable fashion. os.popen() only seems to take a string as the command which would need tricky quoting. os.popen2() can take a...
3
by: Jim Geissman | last post by:
The C++ application calls the database to look up property data. One troublesome query is a function that returns a table, finding data which is assembled from four or five tables through a view...
4
by: Daniel Mitchell | last post by:
I'm interested in computational physics and have defined an abstract base class to represent a simulation. Now I want to develop a GUI for setting the member data of classes derived from my base...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
27
by: Cephalobus_alienus | last post by:
Hello, I know that macros are evil, but I recently came across a problem that I couldn't figure out how to solve with templates. I wanted to create a set of singleton event objects, and wrote...
1
by: =?Utf-8?B?RG9u?= | last post by:
Hello, I'm creating a web service that will allow people to enter their contact information into a SQL Server table. I get it to work when I enter all of the fields and press the invoke button,...
4
by: ipez75 | last post by:
Hello everyone, I have a web application written in asp 6.0, my problem is that I execute a sql server store procedure and I get an empty recordset, while executing the same sp on query anlyzer I...
1
Soniad
by: Soniad | last post by:
Hello, I have stored procedure in which i am passing parameters (varchar(8000)), these parameters can have values or can be empty (''), i have written blocks of codes for each parameter , which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.