SEO Urls 5 by FWR Media & HT SEO 3 by Jack MCS

By | June 26, 2009

Today I had a client who needed HT SEO installed on a site – no real problems as it’s a nice contribution that is well maintained by Jack MCS. However this client is running a Template Monster template, which, as we all know, is the epitome of crap coding…

However, the installation was made. To find that it did not work. After some bug-hunting, I was 100% sure that the error lay with the FWR Media’s SEO Urls 5. So I turned it off. And HT SEO started working flawlessly. Turn it back on and it stopped working…

So, more investigations…led me to see that HT SEO depends greatly upon this: [php]basename($_SERVER[‘PHP_SELF’])[/php] to ascertain which page is being shown in the browser and hence which “tags” to load up and show. My thought was that SEO Urls was in some way blocking this from happening, which was causing the tags not to load, particularly on product_info.php.

So, I opened up /includes/header_tags.php and found this piece of code; [php]require_once(DIR_WS_FUNCTIONS . ‘clean_html_comments.php’); // Clean out HTML comments from ALT tags etc.[/php] Right below it, I added this: [php]echo basename($_SERVER[‘PHP_SELF’]);
exit;[/php] – then I reloaded the page.

With SEO Urls turned OFF, the resulting info was;


And with SEO Urls turned on, the result was something like;


Now, I absolutely knew that the error was as I thought. I then went hunting and found a similar story on the old “Chemo” version of SEO Urls and so I took that code and inserted it in the header_tags.php file in place of the PRODUCT_INFO case.

And it worked! With SEO Urls turned on. I then emailed Jack MCS to see if this would impact on HT SEO. All well.

Anyway, Jack came up with some nicer code as follows;

1. open up /includes/header_tags.php
2. find EVERY occurence of basename($_SERVER[‘PHP_SELF’]) and replace this with $page
3. add this: [php]$pos = strripos($_SERVER[‘PHP_SELF’], “/”);
$page = ($pos !== FALSE) ? basename(substr($_SERVER[‘PHP_SELF’], 0, $pos)) : basename($_SERVER[‘PHP_SELF’]);[/php] right before [php]switch (true) {[/php]
4. save and upload

SEO Urls 5 and HT SEO now play nicely together.

8 thoughts on “SEO Urls 5 by FWR Media & HT SEO 3 by Jack MCS

  1. Claudia

    Hi Gary,

    I tried the solution, but with my site it’s not working.

    I get:
    Parse error: parse error in D:\www\\www\winkelen2\catalog\includes\header_tags.php on line 37

    Best regards,

  2. Gary Post author

    Claudia – means you’ve a mistake at line 37 of the header_tags file

  3. Claudia

    I indeed made a stupid mistake I changed (basename($_SERVER[‘PHP_SELF’]) instead of basename($_SERVER[‘PHP_SELF’]) ( without the ‘(‘). So the page is not giving errors anymore, but Header tags is not working with the new code. It is

    By the way I found this line: switch (true) { twice in header_tags.php, did you added the new code before both the lines?

    And the code that you place that after:
    require_once(DIR_WS_FUNCTIONS . ‘clean_html_comments.php’);
    Do you still have that in your file?

    Maybe it’s not working with my site because I’m on a Windows server.

  4. Gary Post author

    It could be because you are on a windows server – why don’t you change to a linux server, your life would be much easier 😉

  5. misa

    Hi Gary,

    I followed your instructions eg. Jacks instructions and my Header Tags 3.1.5 works fine together with USU5 but only in Rewrite: standard mode. When I toggle USU5 to Rewrite: rewrite mode eg. when urls are .html only default header tag is displayed for all product and category pages. What is solution?

  6. Pingback: Install Ultimate SEO Urls 5 on Windows iis 6 « Struggle with OsCommerce

  7. Gurdeep

    Hi Gary,

    I made the changes to header_tags.php as suggested by Jack in this blog post. It works fine for product and category pages but the other info pages (e.g. about.php) now only show the default title, description and keywords.

    Any idea why this might be happening? I am using Ultimate SEO urls 5 with url rewrite set to ‘standard’. When I turn off ultimate SEO urls 5 it all works fine so must be something to do with how it is reading the path.



  8. Gary Post author

    Hi Gurdeep – can only suggest that you go to the oscommerce support forum and find the relevant support thread.

Leave a Reply

Your email address will not be published.