Search module friendly URLs

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
chrisdoug
New Member
New Member
Posts: 7
Joined: Mon Nov 14, 2011 3:18 pm

Search module friendly URLs

Post by chrisdoug »

Hi all,

Although we have friendly URLs enabled and working throughout our site the search results still display and link in a none friendly manner.

Code: Select all

http://www.domain.co.uk/index.php?mact=Nurseries,cntnt01,detail,0&cntnt01itemid=1&cntnt01returnid=43
Is it possible to show the search results/links as friendly URLs?

Thank you
Last edited by chrisdoug on Tue Mar 04, 2014 2:37 pm, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1968
Joined: Mon Jan 29, 2007 4:47 pm

Re: Search module friendly URLs

Post by Jo Morg »

Read help from module:
in paramters....
(optional) search_method="get" - Pretty Urls Compatibility via Method POST, default value is always GET, to make this work just put {search search_method="post"}
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
chrisdoug
New Member
New Member
Posts: 7
Joined: Mon Nov 14, 2011 3:18 pm

Re: Search module friendly URLs

Post by chrisdoug »

Sorry, had checked this and parameter is already set to post:

Code: Select all

{search resultpage='search-results' search_method='post' modules='Search,News,Blog,Careers,Event,Nurseries'}
Should have mentioned that in previous post, fairly major! This isn't a site I created just trying to help out. Have delved a little deeper, the long URL is a news item returned in the search results.

The URL returned by the seach module is:

Code: Select all

http://www.domain.co.uk/index.php?mact=Nurseries,cntnt01,detail,0&cntnt01itemid=1&cntnt01returnid=43
but should be:

Code: Select all

http://www.domain.co.uk/nurseries/1/43/Town-Day-Nursery/
Thank you

Chris


----------------------------------------------
Cms Version: 1.11.6
Installed Modules:
CMSMailer: 5.2.1
CMSPrinting: 1.0.4
FileManager: 1.4.3
MenuManager: 1.8.5
MicroTiny: 1.2.5
ModuleManager: 1.5.5
News: 2.12.9
Search: 1.7.8
ThemeManager: 1.1.8
CGExtensions: 1.32.4
CGSimpleSmarty: 1.6.1
Captcha: 0.4.6
CGGoogleMaps: 2.4.5
CGFeedMaker: 1.0.17
Elements: 1.1
FormBuilder: 0.7.3
JQueryTools: 1.2.5
TinyMCE: 2.9.12
FrontEndUsers: 1.21.10
SelfRegistration: 1.7.8
CustomContent: 1.8.3
CGContentUtils: 1.3.4
GBFilePicker: 1.3.3
Gallery: 1.6.1
Nurseries: 2.12.9
Blog: 2.12.9
Careers: 2.12.9
Event: 2.12.9
Slider: 2.12.9
Faq: 2.12.9
Menus: 2.12.9

Config Information:
php_memory_limit:
process_whole_template:
output_compression:
max_upload_size: 32000000
url_rewriting: mod_rewrite
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:
phpversion: 5.4.21
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 2048
E_DEPRECATED: 0
memory_limit: 32M
max_execution_time: 60
output_buffering: On
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 8M
upload_max_filesize: 32M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)

Server Information:
Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.35
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

----------------------------------------------
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1968
Joined: Mon Jan 29, 2007 4:47 pm

Re: Search module friendly URLs

Post by Jo Morg »

To be honest I'm not sure that that combination of parameters can be used with pretty URLs. Maybe someone may chime in with more info about this.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
landarone
Forum Members
Forum Members
Posts: 23
Joined: Tue Jun 24, 2014 9:24 pm

Re: Search module friendly URLs

Post by landarone »

Hello there.
Im faceing the same problem.
I have active pretty url and it works fine for CMS links in pages, menus, etc.
When I do search, for example word "Printer" it will find this word in content pages and it gives right results with right URLs (pretty, no more "....index.php?....").
But these search results are correct just only for Content pages not for News pages. When this word "Printer" is also in some News article so search find it and it is also in search results, but with non pretty url.

If its Content page so URL in search result page is:
".....domain.com/products/printers/canon-bex-254/" (pretty)

If its in News article so URL in search result page is:
"....domain.com/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=2&cntnt01returnid=75" (non pretty)

But it should be something like "....domain.com/news/2/76/Canon-bex-launch", because this link I see in summary page for News.

Do you know why Search module gives non pretty url to {$entry->url} and how to make this pretty??
(just for news article link, for every other link it is pretty)

Thank you for advice/help.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Search module friendly URLs

Post by Dr.CSS »

When you click on a New 'more' link does it have pretty URLs in the address bar for the detail page..?
landarone
Forum Members
Forum Members
Posts: 23
Joined: Tue Jun 24, 2014 9:24 pm

Re: Search module friendly URLs

Post by landarone »

Hello.
If you mean link on News page, where are archived news articles, and each of them has a "more" link ($entry->moreurl) so yes, inside of this link is pretty URL. It work fine there.
I also try to give it to the "Search result template", like {$entry->moreurl} or {$entry->morelink}, but it doesnt work. In this template works only {$entry->url} but if search result is some News article so URL is not pretty (but for another, clasic content pages is there pretty url).
Here is my "Search result template":

Code: Select all

<h3>{$searchresultsfor} "{$phrase}"</h3>
{if $itemcount > 0}
<ul>  
  {foreach from=$results item=entry}
    {*  $string|strpos:$char  *}     
    {if ($entry->url|strpos:'index.php') == true}    
      <li><strong>{$entry->title}</strong> - {$entry->urltxt} <a href="{$entry->url}&searchstring={$phrase}">[...show]</a></li>
    {else}
      <li><strong>{$entry->title}</strong> - {$entry->urltxt} <a href="{$entry->url}?searchstring={$phrase}">[...show]</a></li>
    {/if}    
  {/foreach}
</ul>
{else}
  <p><strong>{$noresultsfound}</strong></p>
{/if}
landarone
Forum Members
Forum Members
Posts: 23
Joined: Tue Jun 24, 2014 9:24 pm

Re: Search module friendly URLs

Post by landarone »

Update 1:
While I'm testing and trying to find a solution for this issue I found this:
Pretty URL on all site works on 100%. Problem is in Search with results from News module. This module when is called from some page works OK, I see on summary page links with pretty url.
But when I try to search some word or sentence from any News so Search module find it but return URL non pretty - like without "mod_rewrite".
While I was looking into code I found what do this non pretty url results (when I use Search). It is part of code in "modform.inc.php":
[php_code]
......
if ($prettyurl != '' && $config['url_rewriting'] == 'mod_rewrite')
..........
$text .= '/'.$goto.'?mact='.$modinstance->GetName().','.$id.','.$action.','.($inline == true?1:0).$secureparam;
[/php_code]

and from this it seems to me that "$prettyurl" is empty and so system can't give the right url to results ==> instead of pretty url it calls directly module with other params.
What I can't understand is why on summary page is link pretty (in more) so News module is ok with creating pretty url when is called in page.....but when is called from Search it is not capable to return pretty url??
I also try to change "search_method" to "post" instead of default "get". But no diffrence.
So for me it must lay somewhere in bad url return, when is module called non directly from page?

Update 2:
Next interesting fact is that if I fill "URL" field in editing/creating News article so now Search result gives me back pretty URL. What is also interesting is when I give into this URL field something crazy like "blbablab" so Search result give me still right pretty URL but in page with News summary is link now "blbablab" (for more - moreurl).
So now I'm totally confused.
Locked

Return to “The Lounge”