4

I have the great pleasure of upgrading a Joomla 1.0 site to v3.5 (no comments from the peanut gallery please, lol). Overall it's going just fine, but the old version of writing SEF urls is quite different than v3, and I'm not an expert in Apache/htaccess.

The vast majority of the links that are the greatest concern are those using a custom component for products being sold. such as this:

www.example.com/component/option,com_virtuemart/page,shop.product_details/flypage,shop.flypage/product_id,1/category_id,1/manufacturer_id,0/Itemid,59

There are many core Joomla links such as this in play, and should be converted, but are less critical:

www.example.com/content/view/106/159/

These are the two sets of .htaccess that are currently in use. I've tried placing the v1 SEF section within the new .htaccess file, but it interferes with the workinig v3.5, and the 404 errors seem to persist.

## Begin - Joomla! v1.0 SEF Section (from old site).
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
## End - Joomla v1 SEF Section.

## Begin - Joomla! v3.5 core SEF Section.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
## End - Joomla! core SEF Section.

As it is now, any links such as the above are resulting in a 404 error, so the simplest "simplistic" solution I can imagine (but don't know how to setup) is to have a folder called \component (singular) and within that use .htaccess and mod_rewrite in some way that Apache will parse, capturing the "query string", and redirect anything like it to a custom component where we handle all the conversion issues and redirect accordingly:

www.example.com/component/option,com_virtuemart/.../Itemid,59 rewrites to www.example.com/index.php?option=com_mycomponent&...&Itemid=59

Is this a practical approach, and if so, how would the .htaccess look, and if not, is there another solution that I'm not aware of (not much reliable J1.0 documentation out there anymore)

  • I really sympathize on this one. I'm not htaccess expert, but have you considered using a migrator for this? I had a look around and found this. It will also migrate your Joomla site in addition to VirtueMart. It is commercial though. – Lodder May 31 '16 at 16:12
  • The migration isn't really the issue...it's all the google indexing that's been done using those links. I'm trying to find a way to capture those, and handle them gracefully rather than the 404 error – GDP May 31 '16 at 16:39
4

I managed to piece together a solution without using .htaccess, though I'm interested in a cleaner solution if somebody has one.

  1. I created a system plugin that really does nothing in the conventional sense, in that it has no methods except _construct ().
  2. In the _construct() method, I simply checked for strings in the URI that were found in the old links and are unique to Joomla v1.
  3. If found, it parsed the weird Joomla SEF string into something usable. With that, I constructed the new J3.5 url that I need, and used $app->redirect() to send the user there.

I'm not in love with it, but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.