I am running CMSMS 1.2.1 with pretty urls, and have enabled the Custom 404 Message in Global settings. My custom 404 page includes the search module, in order to help guide users to whatever they were trying to find when they got the 404.
The problem I am encountering is that links to news items generated by the 404 page search do not work correctly
Example:
- go to http://www.edinburghrc.co.uk/rubbish
- do a search for "sponsorship deal"
- click on the first link in the search results http://www.edinburghrc.co.uk/news/341/-1
- 404 page is returned, instead of the expected news item
The cause of the problem appears to be the return_id in the news link URL, which has a value of -1. If you remove the return_id the link works correctly: http://www.edinburghrc.co.uk/news/341
So the search module does not seem to set up a valid return_id when used on the custom 404 page.
That's my diagnosis, but can anyone suggest a solution?
Thanks
Ken
[solved - fix for future?] Problem with search links from custom 404
[solved - fix for future?] Problem with search links from custom 404
Last edited by krussell on Fri Feb 22, 2008 11:37 pm, edited 1 time in total.
Re: Problem with search links from custom 404
I don't know if this is 100% correct or if there is a better solution, I was trying to get it to generate the same pretty urls that you can get with a hack here:
http://forum.cmsmadesimple.org/index.ph ... l#msg94881
But that's going to take more work that I want to invest right now.
Here's how I got it to work for Search results:
Edit /modules/News/News.module.php
At about line 372 change
to
http://forum.cmsmadesimple.org/index.ph ... l#msg94881
But that's going to take more work that I want to invest right now.
Here's how I got it to work for Search results:
Edit /modules/News/News.module.php
At about line 372 change
Code: Select all
$prettyurl = 'news/' . $articleid.'/'.$returnid;
Code: Select all
$prettyurl = 'news/' . $articleid.($returnid>='0'?'/'.$returnid:'');
Re: Problem with search links from custom 404
Thanks very much - that's a neat solution. Possibly this is a fix worth including in a future build?
Ken
Ken
Problem with Search Module & Pretty News URLs
I have successfully created pretty urls for my news postings, such as http:///www.example.com/Baseball-is-fun-to-play/6/51
The name of the url is based on the title entry.
The problem arises when I perform a search with the Search Module. The search provides the standard content pages' url correctly, but for the news pages it shows this instead: http://www.example.com/news/6/51
It replaces the title of the news url with the word 'news.'
But, when I click on this url, i get a 500 internal server error.
Why is this? How can I get the search module to produce an accurate url that works.
Thanks.
The name of the url is based on the title entry.
The problem arises when I perform a search with the Search Module. The search provides the standard content pages' url correctly, but for the news pages it shows this instead: http://www.example.com/news/6/51
It replaces the title of the news url with the word 'news.'
But, when I click on this url, i get a 500 internal server error.
Why is this? How can I get the search module to produce an accurate url that works.
Thanks.