473,757 Members | 5,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=hel lo ? 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 3093
"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=hel lo ?


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 Gotterspammerun g - 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=w g>

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.ch artes.test-1075935661.7196 81%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=w g>


Can be rewritten as <http://groups.google.c om/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.ch artes.test-1075935661.7196 81%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*******@xs4a ll.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=w g>


Can be rewritten as <http://groups.google.c om/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
2890
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 string or a list - the relevant code in Unix python (in popen2.py) being... def _run_child(self, cmd):
3
1538
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 that has a join, and then updating the resulting @table from some other tables. There are several queries inside the function, which are selected according to which parameters are supplied (house #, street, zip, or perhaps parcel number, or house...
4
1736
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 class. I've approached this problem by creating a class named Interface with an overloaded member function named addParameter(): class Interface { public: void addParameter( int& param );
1
9135
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 in a System.Guid object. Unfortunately, I'm having zero luck doing this. Public Function BuildExtract(byval ProjectNumber as string, byval ListNumber
1
3068
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 in a System.Guid object. Unfortunately, I'm having zero luck doing this. Public Function BuildExtract(byval ProjectNumber as string, byval ListNumber
27
2632
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 the following macro: #define GET_SINGLETON_EVENT_FUNCTION(FUNCTION_NAME,MANUAL_RESET,\ INITIAL_STATE,EVENT_NAME) \
1
2332
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, but if I leave one of the integer fields(ie StateID) empty if errors out. I tried to make the parameters optionally but it says thats not possible with a webmethod. How do you handle empty integer fields. I put the code below. Thanks
4
2587
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 can see 5 records. Basically the sp create a temp table, populate it, and lastly selects the results from the temp table. I read on a preceding post to insert the clause: "SET NOCOUNT ON" to avoid getting closed recordset of the insert statements, so...
1
4783
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 executes only if parameter has values, it should not enter the block if parameter is empty, how to detect whether the parameter is empty or not. and also i am having output parameter (varchar(1)) that is returned by stored procedure, if all of...
0
9297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.