Query strings and search engines: /albums/p/X instead of /?p

dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Mon, 2002-11-25 22:01

I also use this weblog for my page and am going to try out this hack for their system.
<!-- BBCode Start --><A HREF="http://tidakada.com/board/viewtopic.php?t=1273" TARGET="_blank">http://tidakada.com/board/viewtopic.php?t=1273</A><!-- BBCode End -->
i was wondering what people's opinions are of it and if this is something cool for gallery. I've noticed google doesn't mind as much regarding query strings in the address bar, but others do Anyone?

for ex:
/gallery/view_album.php?set_albumName=album15

would become

/gallery/view_album.php/set_albumName/album15

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2002-11-25 23:27

Is this as an alternative for those who don't have mod_rewrite?

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Tue, 2002-11-26 00:04

I don't really know much about it actually, it was just something I saw on that b2 site and I thought I would try for that php package and though it would be cool to discuss here. Is the mod_rewrite what you use to change what gets written in the address bar? Sorry, I may be MIT, but I wasn't a comp sci guy at all so.... :wink:

Can you explain how you would approach it? Maybe others and share their ideas on it. I'm sure anyway to help a search engine result would be cool..

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2002-11-26 00:26

Well, provided you have mod_rewrite working, that's exactly what it does (at least for Gallery... it can do many other things). It takes a URL like
http://www.mysite.com/gallery/birthday2002/photo_of_cake
... and turns it into:
http://www.mysite.com/gallery/view_photo.php?set_albumName=birthday2002&amp;id=photo_of_cake , which the PHP code can understand.
With no "?" or "&amp;"s, search engines will now catalogue these pages. (I just Googled my site... and sure enough it has those pages catalogued).
I definitely think mod_rewrite is the most elegant solution for this task, because it abstracts the URL rewrite from the PHP code completely. Have you downloaded that code that you linked to? I'd be interested to see what they put in the .htaccess file included with the code.

-Beckett (beck@beckettmw.com)

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Tue, 2002-11-26 00:36

I thought I read about something like that. They use a bunch of variables to make it easier for their own cvs like $querystring_start and $querystring_equal in already present code. Their htaccess code is:

# this will make register globals off in b2's directory
# just put a '#' sign before these three lines if you don't want that

<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>

# this is used to make b2 produce links like http://example.com/archives/m/200209
# if you renamed the file 'archives' to another name, please change it here too

<Files archives>
ForceType application/x-httpd-php
</Files>

Since the tech guy for our company is actually my roommate, I can ask if mod_rewrite is set on our server. He would probably know how I can implement it for my entire site then. If not, I'll search through the forums here now to see if anyone has documented it or can point me. I would love to get this going for the search engines.

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Tue, 2002-11-26 01:04

I just posted in that forum asking the coders why they chose this option instead of mod_rewrite and this was the last reply

<!-- BBCode Start --><A HREF="http://tidakada.com/board/viewtopic.php?p=7789#7789" TARGET="_blank">http://tidakada.com/board/viewtopic.php?p=7789#7789</A><!-- BBCode End -->

This is just better... :wink: Before this came along I was using mod_rewrite to make urls like /archives/2002/11/25, which is nice, but there is extra overheard for the server in processing urls and rewriting them, plus it isn't integrated into b2's url generation, so while it's good for 'external' urls, it doesn't work so well for all the different links you'd make on the page itself through b2. Additionally, while mod_rewrite is fairly common, I know a lot of servers that don't have it available... if someone makes even a very tiny mistake it can cause serious problems with server load, and of course then the support staff have to deal with explaining to someone why every single page on their site is an internal server error.... and trust me, it happens a lot.