• Home
  • Get help
  • Ask a question
Last post 6 hours 18 min ago
Posts last week 94
Average response time last week 34 min
All time posts 67837
All time tickets 10483
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#2559 – Removing the pre '?' part of the URL

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Tuesday, 02 August 2016 12:16 UTC
SilvermanSS
[xxxx]

I've just gotten a new component made, and it has pagination at the bottom - see link. Unfortunately when you click on a new page (which is meant to be https://www.xxxx.com/free-music?lang=en&limit=12&view=musics&start=12 and displays then when you mouseover the link), I'm redirected to https://www.xxxx.com/?start=12

When I disable SH404SEF this resolved the issue, so I thought I'd open a support ticked to see if you could give me a hand.

Thanks very much,

Shane
Tuesday, 02 August 2016 12:23 UTC
wb_weeblr
Hi

The thing you can try is to set the "By component" first option of sh404SEF configuration corresponding to that custom component to:

1 - Use Joomla router
or
2 - Leave as non-sef

Please note that the URL you listed above (with ...start=12) indicates a programming error in the component. This value should be "...limitstart=12". Whether it "works" with Joomla is irrelevant here as we don't always use the same standard.
Also, do you know if your component comes with a router.php file for creating SEF URLs?

Rgds
 
Tuesday, 02 August 2016 15:17 UTC
SilvermanSS
Thanks very much for the quick response.

I did change the settings for this component to "Use Joomla! router", and the pages can now be accessed. However, now there is a new URL instead of the query: https://www.xxxx.com/free-music/musics?lang=en&limit=12&start=12 so we've got an extra slash in there now. Id rather not have that as I suspect it'll count as duplicate content.

I've just looked in cPanel, and there is indeed a router.php file in the component's folder. Here is its contents (hope it's okay to paste here):

<?php

/**
* @version CVS: 1.0.0
* @package Com_Vcpmusic
* @author xxxx <xxxx>
* @copyright 2016 xxxx
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;

JLoader::registerPrefix('Vcpmusic', JPATH_SITE . '/components/com_vcpmusic/');

/**
* Class VcpmusicRouter
*
* @since 3.3
*/
class VcpmusicRouter extends JComponentRouterBase
{
/**
* Build method for URLs
* This method is meant to transform the query parameters into a more human
* readable form. It is only executed when SEF mode is switched on.
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
$view = null;

if (isset($query['task']))
{
$taskParts = explode('.', $query['task']);
$segments[] = implode('/', $taskParts);
$view = $taskParts[0];
unset($query['task']);
}

if (isset($query['view']))
{
$segments[] = $query['view'];
$view = $query['view'];

unset($query['view']);
}

if (isset($query['id']))
{
if ($view !== null)
{
$model = VcpmusicHelpersVcpmusic::getModel($view);
if($model !== null){
$item = $model->getData($query['id']);
$alias = $model->getAliasFieldNameByView($view);
$segments[] = (isset($alias)) ? $item->alias : $query['id'];
}
}
else
{
$segments[] = $query['id'];
}

unset($query['id']);
}

return $segments;
}

/**
* Parse method for URLs
* This method is meant to transform the human readable URL back into
* query parameters. It is only executed when SEF mode is switched on.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$vars = array();

// View is always the first element of the array
$vars['view'] = array_shift($segments);
$model = VcpmusicHelpersVcpmusic::getModel($vars['view']);

while (!empty($segments))
{
$segment = array_pop($segments);

// If it's the ID, let's put on the request
if (is_numeric($segment))
{
$vars['id'] = $segment;
}
else
{
$id = $model->getItemIdByAlias(str_replace(':', '-', $segment));
if (!empty($id))
{
$vars['id'] = $id;
}
else
{
$vars['task'] = $vars['view'] . '.' . $segment;
}
}
}

return $vars;
}
}
Tuesday, 02 August 2016 15:47 UTC
SilvermanSS
Okay, after some fiddling - I've created a brand new menu item with a unique name (set to superuser access only at the mo).

So I've published it, have SH404SEF with all the default settings, and it works absolutely fine. the URL is stable with only the queries appended afterwards. It seems to be because I've reappropriated a URL that i already used before (I just changed the menu item type).

So it seems to be an issue where the URL was previously used elsewhere. Is there some sort of caching in SH404SEF that remebers old components that were associated with menu items or URLs?

I really do need to keep my URL the same, so any suggestions you have would be very welcome!

Thanks again,

Shane
Tuesday, 02 August 2016 17:36 UTC
wb_weeblr
Hi

So it seems to be an issue where the URL was previously used elsewhere. Is there some sort of caching in SH404SEF that remebers old components that were associated with menu items or URLs?
It's more than caching. URLs pair (ie the non-sef + the SEF) are stored permanently in the database, so that you can attach to them meta data, manually customize them and many other things. They stay in the database until they are deleted. Changing an item title or moving it to another category does NOT affect the URL stored in the database, and this is happen, you have to delete the existing URLs so that new ones are created again. Please see the first page of sh404SEF for more details, on this page.

Rgds

 
Tuesday, 02 August 2016 17:50 UTC
SilvermanSS
I have deleted them and created them again - It doesn't work. I've purged everything, and recreated the page, and it doesn't work. Unless you mean the database tables I access via cPanel?

That still doesn't explain why part of the URL is removed when I use pagination in the component. If I make the component from scratch from a never-before-used URL everything works fine. I'm not sure how to delete the stored URLs.
Tuesday, 02 August 2016 18:00 UTC
wb_weeblr
Hi

Well, we have written a whole backend for sh404SEF, that's not to use CPanel!

As your component doesn't have specific support for sh404SEF URL construction, I would suggest the following:

1 - Under the "By components" tab of sh404SEF configuration, for the row corresponding to your component, select:

"Use default handler" on the first column, and "Use router.php with menu item" on the second one

2 - Purge URLs in the URL manager
3 - Visit your site home page and navigate to wherever those pages are

Rgds
 
Tuesday, 02 August 2016 18:11 UTC
SilvermanSS
Thanks for your continued help - very much appreciated by the way.

I've just done what you've suggested. Unfortunately, it's still redirecting me to the homepage. The mouseover URL, when I hover over page 2 in the pagination section, is https://www.xxxx.com/free-music?lang=en&limit=12&view=musics&start=12

But this resolves to https://www.xxxx.com/?start=12

Any other suggestions?

Thanks
Tuesday, 02 August 2016 18:33 UTC
wb_weeblr
Hi

ok, I didn't realize this was a redirect, I though the URL was wrong.

So if the URL is correct, but there is a redirect, then you have to look at:

1 - the Aliases page in sh404SEF backend, and see if you have entered there ?start=12
2 - Click on the Home page meta button, and check the Aliases tab, looking for the same

If none of this succeeds, then it might be another plugin doing those redirects, or even the component itself actually.

Rgds
 
Tuesday, 02 August 2016 18:45 UTC
SilvermanSS
Okay, I've not got ?start=12 as an alias, either in the alias section or the homepage section. I don't think it's the component, or any other component, as like I said when I create a brand new menu item it works as intended. For example I created a menu called Music Test, assigned the component to it, then navigated to the page from the fontend. It worked as expected with the URL being /music-test and when using the pagination /music-test?xyz

In SH404SEF the non SEF URLs for /free-music and /music-test were totally identical (apart from the Itemid code of course).

See the /free-music URL used to be another component. Which is making me think that it's something to do with it being associated somehow to that old component. If I disable the SEF Optimization within SH404SEF the problem disappears, and the query string works perfectly.

Something within SH404SEF is doing something odd with the query strings
Tuesday, 02 August 2016 20:28 UTC
SilvermanSS
I think I fixed it! for some reason free-music/ was an alias of free-music. So the same thing but with a slash on the end - I deleted it, and the query strings appear to be working!

Thanks for your time and effort, once you put me onto looking at aliases, that really helped. But in case someone else ever has this issue, that's one more thing you could suggest.

Shane
Wednesday, 03 August 2016 07:43 UTC
wb_weeblr
Hi

Glad to hear that! Yes, aliases and redirects should not be setup lightly. Though it's pretty easy to do with sh404SEF, sometimes this can bite back.

But in case someone else ever has this issue, that's one more thing you could suggest.
Hmm, unfortunately, each support case is like starting afresh, all new! As with all large extensions, or Joomla itself, there are many things that can affect the final result.

Closing this ticket now, feel free to open a new one as needed. If you do so, please mention this ticket number in the new one.

If you created any superadmin account for us, be sure to delete or block it now to avoid unnecessary risk in the future.

Be sure to also check out wbAMP, our new Accelerated Mobiles pages plugin for Joomla - the next big thing is SEO, direct from Google themselves!

Rgds
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.