Forum Moderators: coopster

Message Too Old, No Replies

Multiple variable in URL ...

Google and SEO behavior and alternative to GET method

         

tomda

8:41 am on Dec 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I have read some topics regarding url with multiple variables (index.php?........).

From what I have read, there are two important points that I should not ignore :

1/ Not to have a variable called $id
2/ Stick to 2 or 3 variables max

My website is a databank of pictures and user can see pic in thumbnail formats. Because they have the possibility to set a number of results, to order them differently, type search keywords, etc... my url can have upto 8 variables. Though, I have done a small php script to remove the var from the URL when the variable is NULL, I am not satisfied and am afraid that my HEAVY databased website will not be fully indexed.

I am aware of the mod_rewrite in Apache, but I'd like to know if there are other alternatives. Is placing variable (such as $order, $qty) in session is a good procedure or should I just eliminate these features in order to reduce my URL?

Thanks

coopster

10:31 pm on Dec 2, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



$order and $qty don't sound like very good url/path structures to me -- it sounds like something you would use during a shopping/checkout type session.

Or it is order as in ascending/descending and quantity as in quantity to display on the page at one time?

HughMungus

10:37 pm on Dec 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anyone know if this would work (I just thought of it).

You could have a URL that looks like this:

[foo.com...]

Then when your page reads that variable, it parses out such that 11 in the first two digits position means do this, 22 in the second two digits positions means do that, 33 in the third two digits position means put it in such and such order, etc. etc.

I have no idea how practical it is but I don't see why it wouldn't work if you use strings of the same length all the time (where, for example, 00 would mean do nothing).

baze22

11:02 pm on Dec 2, 2004 (gmt 0)

10+ Year Member



One way I've dealt with this type of thing is to use a function for create a single variable out of several:
function makevar($tid,$torder,$tqty){
//add code to check validity of vars and then
return $tid . '-' . $torder . '-' . $tqty;
}

Then I'm just passing one var instead of 3 also makes it easier to use with mod_rewrite too.

When the var is passed I just explode into an array and process the vars as needed.

baze

HughMungus

3:08 am on Dec 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Even better.

tomda

5:21 am on Dec 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, Coopster, order is either ascending/descending and quantity is indeed the quantity to display on the page at one time.

The idea of combining variable in one string is great. I could definitely reduced the number of variable to one this way. I will give it a try.

Thanks

twist

8:23 am on Dec 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From what I have read, there are two important points that I should not ignore :

1/ Not to have a variable called $id


Uh oh, why exactly can't you use $id as a variable? I have been using it for some pages for quite some time without any issues that i've seen. I don't think it is a reserved word, is it?

tomda

9:22 am on Dec 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because SEO may interpret your $id variable as a session_id variable and therefore they may ignore it.

HughMungus

3:58 pm on Dec 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



tomda, I was just on ebay and it appears they do the single-string, multiple variable trick, e.g.:

[search.ebay.com...]

Notice the variable names, "catref", "from", "sacategory", "sosortorder", and "sosortproperty". Funny what you notice when you're looking.

tomda

4:27 pm on Dec 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for your last post HughMungus

This just confirm that they are very good reason why I should stick to one multistring variable in my GDgallery.

Tomda

twist

5:28 pm on Dec 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because SEO may interpret your $id variable as a session_id variable and therefore they may ignore it.

Ok, that makes sense, thanks for clearing that up. I use RewriteRule so all my addresses look like example.com/1234/1234. Much relieved.