Jump to content

Automatically redirect review detail URLs to listing detail page.


Alejandro

Recommended Posts

Someone recently asked why review detail pages continue to work even if review discussions are disabled. This is by design becase a review detail page is a piece of content on its own that can be shared and indexed even if discussions are disabled.

A filter can help deal with this if you have a specific need different from the core functionality like redirecting the URLs to the detail page. Of course you can also add a wildcard line to your robots.txt file to tell search engines to stop indexing these pages if that's what you want.

Here's the redirect filter https://www.jreviews.com/docs/hooks/before_theme_render_viewvars

Clickfwd\Hook\Filter::add('before_theme_render_viewvars_discussions_review', function($viewVars, $params) 
{
	$url = \Joomla\CMS\Router\Route::_($viewVars['listing']['Listing']['url']);
	cmsFramework::redirect($url, 301);
  	die;
});

This goes in the jreviews_overrides/filters/filter_functions.php file per the documentation https://www.jreviews.com/docs/developers/hooks

Link to comment
×
×
  • Create New...