Page 1 of 1
Search module friendly URLs
Posted: Tue Mar 04, 2014 2:29 pm
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
Re: Search module friendly URLs
Posted: Tue Mar 04, 2014 2:34 pm
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"}
Re: Search module friendly URLs
Posted: Tue Mar 04, 2014 2:46 pm
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
----------------------------------------------
Re: Search module friendly URLs
Posted: Tue Mar 04, 2014 2:56 pm
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.
Re: Search module friendly URLs
Posted: Mon Jun 30, 2014 12:22 pm
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.
Re: Search module friendly URLs
Posted: Tue Jul 01, 2014 4:17 am
by Dr.CSS
When you click on a New 'more' link does it have pretty URLs in the address bar for the detail page..?
Re: Search module friendly URLs
Posted: Tue Jul 01, 2014 7:54 am
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}
Re: Search module friendly URLs
Posted: Fri Jul 04, 2014 3:19 pm
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.