surviving the weekend – my way.

friday afternoon. i managed to escape from work at ~5.3o pm. could ‘ve been worse. went home and hunted for my customers. it’s a strategical moment… either i can be buried in work for next one week, be work-less and sentenced to spend weekend not doing anything or – as in this case – gather requirements for some small tasks that perfectly fit in next two days. later on i went out for few hours to meet few people from work in some not-very-noisy club/pub in the city, had two ciders, went back home. great thing about sweeden: smoking is banned in all restaurants/clubs/pubs. no more wear once/wash immediately clothes problem.

falling asleep at 11pm on friday night is .. at least inappropriate. i’ve done 1/3rd of weekend tasks. goal: make links to products and categories at google-friendly. what is it about? optimizing any e-commerce website to be crawler friendly become necessity nowadays – most of customer come to web-shops from google/yahoo/msn search result page. the higher in results of search page is, the more sub-pages gets indexed and re-indexed quickly – the more potential customers will visit the site. a very basic, and considered as ethical, method of SEO is removing question marks from all links to pages generated on the fly. search engines tend to be very reluctant when it comes to crawling links that pass arguments after question mark. why? chances are that part of arguments might be unique session id – in result search engine will discover every time different urls leading to the same content [typical example of not-google-friendly site can be any out-of-the box phpbb or oscommerce installation with links like: profile.php?mode=register&sid=b0848457086214339e74ce4ceca6f7eb].

so one more time – in my case – goal was to transform product.php?id=123 links into p123_something_something.php while keeping all the page generated dynamically based on database of products and categories. my way of solving problem was pretty lazy [or in corporate language: efficient] – based on .htaccess file – i just addedd single line to it:

ErrorDoc 404 /u/error.php

the outcome? any request that points to non-exsiting file/script will be dispatched by my script called error.php. in this script – as one of elements of $_SERVER array i’ll get whole url. i can parse it and take product id out of it as below:

        header("HTTP/1.1 200 OK");
        // if file part of url starts with 'p' it should be treated as product page
        if (strstr(@$_SERVER['PATH_REDIRECTED'],"/p")!=false){    
                $i = explode("/p",@$_SERVER['PATH_REDIRECTED']);
                $i = explode("_",@$i[1]);
                $i = $i[0];
                include("product.php"); // invoke 'old' product.php handler
// i used similar approach for categories

saturday .. nice url’s are running fine. one gets the same content displayed both when invokes product.php?id=123 and p123_whatever.php. last step in this task is navigation re-work. i needed to change all links generated on different pages from product.php?id={$} to p{$}_whatever.php. site is template drive so no other changes in php code were required.

btw – few months ago i’ve done similar process to ‘fix’ you never know what is the cause of increased number of hits website gets: better advertising on peer sites, higher position on google or just pure luck. anyway – hit counter is running even quicker right now :-]

in the afternoon i took some fresh air, had a walk, got back home, resurrected some failing server @ work and got back on my weekend track: started to gather requirements for next weekend jobs while studying google sitemaps. in contrary to ‘google-friendly’ links case i’m first timer when it comest to sitemaps. we’ll see if it really gives any benefit. idea is simple: publish xml containing list of all cruicial subpages and date of last modification, let google know about it and hope it will visit newly updated/created pages much quicker.

lazy sunday: to the usual ritual [ wake up→computer→church→computer→shave→wash→sleep] i’ve added swimming pool. to mk sunday less lazy [or in other words to catch another deadline] i’ve migrated 223 e-mail accounts from one server to another for multicon / gdansk… hopefully within next few days/weeks i’ll put somewhere here my recipe for fully blown mail server with sql based accounts management / antispam / antivir filters based on postfix.

more info on SEO can be found here:

Leave a Reply

Your email address will not be published. Required fields are marked *

(Spamcheck Enabled)