0

How can I get URL format given below for a custom component in Joomla 3 ( migrating / converting site from Joomla 1.5. Just for seo purpose, I want to keep url same for now )

sitename.com/component/option,com_my_comp/Itemid,123/task,mytask

I have seen non-sef format like

sitename.com/index.php?option=com_my_comp&Itemid=123&task=mytask

Or

sef url format like

sitename.com/my-comp-page

For SEF URLs, I am using SH404SEF extension. Thanks.

2

You can use sef_ext plugins.

In sh404sef find sef_ext folder and create com_my_comp.php file

<?php 
defined('_JEXEC') or die('Direct Access to this location is not allowed.');

    // ------------------  standard plugin initialize function - don't change ---------------------------
    $sefConfig = &Sh404sefFactory::getConfig();
    $shLangName = '';
    $shLangIso = '';
    $title = array();
    $shItemidString = '';
    $dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option);
    if ($dosef == false)
    {
        return;
    }
    // ------------------  standard plugin initialize function - don't change ---------------------------

    $title[] = 'my-comp-page';


    shRemoveFromGETVarsList('view');
    shRemoveFromGETVarsList('id');
    shRemoveFromGETVarsList('option');
    shRemoveFromGETVarsList('lang');
    shRemoveFromGETVarsList('task');



// ------------------  standard plugin finalize function - don't change ---------------------------
if ($dosef)
{
    $string = shFinalizePlugin($string, $title, $shAppendString, $shItemidString, (isset($limit) ? $limit : null),
        (isset($limitstart) ? $limitstart : null), (isset($shLangName) ? $shLangName : null), (isset($showall) ? $showall : null),
        $suppressPagination = true);
}
// ------------------  standard plugin finalize function - don't change ---------------------------
?>

With shRemoveFromGETVarsList you can remove any parameter added to url.

It's not a good idea use comma character in url, to get something like your first url:

$jinput = JFactory::getApplication()->input;
$Itemid = $jinput->getInt('Itemid');

$title[] = 'option_'.$option;
$title[] = 'Itemid_'.$Itemid;
$title[] = 'task_'.$task;

If you want to use comma, you can enable it, in sh404sef configuration panel, in "Strip characters" option.

0

you can use redirect with params:

site.com/blog?limitstart=0 to site.com/blog

RewriteCond %{QUERY_STRING} ^limitstart=0
RewriteRule ^blog http://site.com/blog? [R=301,L]

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.