Painful 301 domain redirect discoveries using Joomla com_sef 404sef

by Caroline on July 24, 2006

Answers the question:
How to redirect domains given tools .htaccess, parked domain redirect and Joomla component 404sef.

If you use Joomla and care at all about search engine rankings you’ll have to use a SEF translation of some kind. I chose 404sef and I’m grateful for what it does. Here’s how to get around something it doesn’t do, which is handling non-primary domains.
It will make Search Enging Friendly links for the current domain, but if you redirect a different domain to the 404Sef’d one the component will cough up a hair ball.

Setup:

  1. Joomla 1.0.10
  2. Siteground.com hosting cpanel with parked domains
  3. Global config: SEF on
  4. SEF404 config: SEF on
  5. secondary domains that need to redirect in a search engine friendly way to http://www.bombshelters.com/:

biologicalprotection.com
biologicalshelter.com
biologicalshelter.us
biologicalshelters.com
biologicalshelters.us
blastshelters.com
blastshelters.us
bombshelter.us
chemicalprotection.us
combatshelter.com
disastershelter.com
falloutshelter.us
governmentprotection.com
nbcshelter.com
nbcshelter.us
nuclearprotection.us
nuclearshelter.us
nuclearshelters.com
radiusdefense.com
radiusengineering.us
radiusengineeringinternational.com
radiusengineeringintl.com
radiusshelters.com
saferoomprotection.us
shelterengineering.com
shelterprotection.us
sheltersystems.us
survivalshelter.us
survivalshelters.us
undergroundshelter.us
undergroundshelterengineering.com
undergroundshelters.com
undergroundshelters.us
wmdprotection.us
Setup secondary domains to resolve to primary domain

These domains are all registered on network solutions. I changed the primary and secondary name servers on all of them to the siteground name server for bombshelters.com. Then on cpanel for bombshelters.com I used the “parked domains” tool to point each of the domains to bombshelters.com.

This worked, and then broken suddenly tonight. It actually probably broke when I installed 404SEF I just didn’t realize it.

Symptoms

I guess I had 404SEF off when I redirected the domains to the bombshelters.com name server because m initial tests worked great. You’d type undergroundshelter.us and the browser would display bombshelters.com content under the undergroundshelter.us address bar. When I tried that tonight I got “this page cannot be displayed.”

The pubic_html errorlog pointed to:

[24-Jul-2006 00:58:57] PHP Warning: strpos() []: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83

[23-Jul-2006 23:04:24] PHP Fatal error: Call to undefined function: sefreltoabs() in /home/bombshel/public_html/components/com_content/content.html.php on line 584

Things that don’t fix the problem

  1. Turning off 404SEF: it fixes the problem but creates the old problem of unfriendly URLs
  2. Ensuring the strpos delimiter (and target) are not empty on sef404.php:
  3. [24-Jul-2006 00:58:57] PHP Warning: strpos() [function.strpos]: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83

    bold line below is line 83

    if (!empty($pathdata) && (!empty($sefconfig->suffix)))

    {
    if (strpos($pathdata,$sefconfig->suffix) !== false)
    $path_array[$x] = str_replace($sefconfig->suffix,”",$pathdata);
    $x++;
    }

    This is fine as far as it goes, it’s good to test inputs before assuming they have content, but it addresses a symptom, not a problem.

  4. Similar to #2, defining sefRelAbs function against its will

]: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83]: Empty delimiter. in /home/bombshel/public_html/components/com_sef/sef404.php on line 83content.html.php:
if (!function_exists(’sefRelToAbs’))
{
function sefRelToAbs($string) {}
}
What does work

In .htaccess rewrite any domain that is not http://www.bombshelters.com/ to be http://www.bombshelters.com/. Works for “bombshelters.com” (without www), “falloutshelter.us,” and etc. secondary domains.
RewriteCond %{HTTP_HOST} !bombshelters.com$ [NC]
RewriteRule ^(.*)$ http://bombshelters.com/$1 [L,R=301]

Big thank you to http://enarion.net/web/apache/htaccess/redirect-www-and-no-www/

 

{ 0 comments… add one now }