Search Engine Friendly URLS with News Module
Re: Search Engine Friendly URLS with News Module
Yes. It'd be great to have the breadcrumb indicate the category one is in. The return Id just goes back to the main, when it ought to go back to the parent category of that article.
Thanks ! I hope this is resolved soon, it's something that I would like too.
Thanks ! I hope this is resolved soon, it's something that I would like too.
Re: Search Engine Friendly URLS with News Module
Elijah, thanks for your great work. I have still one question.. Is it also possible that the xml/rss feed is feeded with the search engine friendly urls? At the moment the rss feed shows the "old" urls. Hope there is a solution for this, would be great!! 

- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: Search Engine Friendly URLS with News Module
It's possible, but sadly I don't have time at the moment (homework).baselve wrote: Elijah, thanks for your great work. I have still one question.. Is it also possible that the xml/rss feed is feeded with the search engine friendly urls? At the moment the rss feed shows the "old" urls. Hope there is a solution for this, would be great!!![]()
I think if you open modules/News/action.rss.php there should be a call to CreateLink() that would match what was changed in action.default.php
Later,
Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: Search Engine Friendly URLS with News Module
Thank you very much! Adding these lines does the trick!Elijah Lofgren wrote:It's possible, but sadly I don't have time at the moment (homework).baselve wrote: Elijah, thanks for your great work. I have still one question.. Is it also possible that the xml/rss feed is feeded with the search engine friendly urls? At the moment the rss feed shows the "old" urls. Hope there is a solution for this, would be great!!![]()
I think if you open modules/News/action.rss.php there should be a call to CreateLink() that would match what was changed in action.default.php
Later,
Elijah
Code: Select all
$titleSEO = preg_replace("/[^\w-]+/", "-", $row['news_title']);
$categorySEO = preg_replace("/[^\w-]+/", "-", $row['news_category_name']);
$onerow->link = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, '', $sendtodetail,'', true, false,'',true, 'News/'.$categorySEO.'/'.($detailpage!=''?$detailpage:$titleSEO.'-'.$row['news_id']));
Re: Search Engine Friendly URLS with News Module
My customer ordered windows hosting, so I had to use isapi rewrite. Now my website works well, except the news module.
The rewrite module works well with apache rewrite, so my question is, what needs to be changed in my files to let this module work again?
here is my httpd.ini:
Please help me
The rewrite module works well with apache rewrite, so my question is, what needs to be changed in my files to let this module work again?
here is my httpd.ini:
Code: Select all
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]
# Defend your computer from some worm attacks
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
#RewriteCond Host: (.*)
#RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R]
#RewriteRule ^(.+)$ index.php\?page=$1 [I,L]
RewriteRule /([^/]+)\.html /index.php\?page=$1 [I,L]
Re: Search Engine Friendly URLS with News Module
Hello hadion,
This thread demonstrates that non windows hosting rocks. Your customer has ordered something else. Of course he can be disappointed.
But there may be a nice side of the story : if your customer demands windows hosting, he must have good reasons. May be the windows/isapi knowledge that can tune the rewrite ? I'm confident the rewrite rules can work under isapi, I just don't know how.
Pierre M.
I'm sorry, I don't know Windows hosting nor the isapi thing. I'm used to httpd.conf and .htaccess.hadion wrote: My customer ordered windows hosting, ... isapi rewrite. ... httpd.ini ...
This thread demonstrates that non windows hosting rocks. Your customer has ordered something else. Of course he can be disappointed.
But there may be a nice side of the story : if your customer demands windows hosting, he must have good reasons. May be the windows/isapi knowledge that can tune the rewrite ? I'm confident the rewrite rules can work under isapi, I just don't know how.
Pierre M.
Re: Search Engine Friendly URLS with News Module
Yeah i know linux is better. But my customer allready ordered the hosting before I started with the website. Everything works now, except the news module... Anyone who can help me?
Re: Search Engine Friendly URLS with News Module
Use the version 3 of isapi_rewrite. It is almost 99% compatible with the Apache mod_rewrite.hadion wrote: Yeah i know linux is better. But my customer allready ordered the hosting before I started with the website. Everything works now, except the news module... Anyone who can help me?
Re: Search Engine Friendly URLS with News Module
Hi
- My first post here, I use several CMSs and you can tell much from the tone of the community - I havent seen to much annimosity yet here, so I'm liking what I see!
I am doing a favour for a friend who has a CMSMS site. The company that built the site for him are claiming that friendly news urls would be difficult to implement which I thought was probably wrong....
So I am trying to help him out by switching on friendly URLs for the news section.
I have tried all the instructions here, tried patching files, over writing them and making the changes by hand - nothing... The URLs in the news section do not seem to change, I have tried clearing the cache also nothing... stranglely though if I create a new news story this does not appear anywhere or if I change the title of a news story this is not reflected in the front end.
can anyone help me - I am thinking perhaps the changes are not compatiable with the versions of CMS MS and the news module I am using:-
CMSMS - ver 1.2
News - ver 2.5.1
Any help would be just great.
Thanks -
- My first post here, I use several CMSs and you can tell much from the tone of the community - I havent seen to much annimosity yet here, so I'm liking what I see!
I am doing a favour for a friend who has a CMSMS site. The company that built the site for him are claiming that friendly news urls would be difficult to implement which I thought was probably wrong....
So I am trying to help him out by switching on friendly URLs for the news section.
I have tried all the instructions here, tried patching files, over writing them and making the changes by hand - nothing... The URLs in the news section do not seem to change, I have tried clearing the cache also nothing... stranglely though if I create a new news story this does not appear anywhere or if I change the title of a news story this is not reflected in the front end.
can anyone help me - I am thinking perhaps the changes are not compatiable with the versions of CMS MS and the news module I am using:-
CMSMS - ver 1.2
News - ver 2.5.1
Any help would be just great.
Thanks -
Re: Search Engine Friendly URLS with News Module
Just spent an hour working through the examples and got it all working on CMSMS 1.2.3
Elijah, your a legend !!! thanks for your work on this.
Courty
Elijah, your a legend !!! thanks for your work on this.
Courty

www.debinternet.co.uk - UK based CMSMS & Full Access Linux Webhosting, Site Design and Custom Coding..
Re: Search Engine Friendly URLS with News Module
care to share courty? 

Re: Search Engine Friendly URLS with News Module
I did it too a while back, but I couldn't get the templates to work. So only the default, any other wouldn't work.
Please share what you did.
Please share what you did.
Re: Search Engine Friendly URLS with News Module
Hi Guys,
Yes, no problem...
You have to edit 4 files from the Modules / News folder..
action.default.php
action.details.php
News.module.php
and action.rss.php
action.default.php
Find
and REPLACE it with
action.detail.php
Find
and REPLACE it with
News.module.php
Find
And ADD after the {
action.rss.php
Find
and REPLACE it with
I've played with the spacing and code layout so you will have to look / search the files by hand, don't use an automated tool.
You will need the standard Pretty URL's .htaccess file and Pretty URL's already working for articles etc.
The hack also fixes the RSS feed for the new URLs's.
Both Old style URL's still work so SEO is not affected.
These files are from CMSMS version 1.2.3 "Black Rock" (upgraded from 1.2.2), on Apache and Red Hat with MySQL 5 back end (not that it should make a difference..)
I have not added the hack to take out the article number so URL's look like http://mysite.com/News/General/my-story-[b]12[/b].shtml, I did look at the code but it didn't work + I ran out of time to fix it.
if you want to see it working, have a look at http://www.avicraft.co.uk
Remember to make a backup of the files BEFORE you edit them, I normally copy the file to the same folder and append the date so action.default.php becomes action.default.php.210107, then edit the original file...
Let me know if you have a problem..
Regards
Courty
Yes, no problem...
You have to edit 4 files from the Modules / News folder..
action.default.php
action.details.php
News.module.php
and action.rss.php
action.default.php
Find
Code: Select all
$onerow->titlelink = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, $row['news_title'], $sendtodetail, '', false, false, '', true, $prettyurl);
$onerow->morelink = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, $moretext, $sendtodetail, '', false, false, '', true, $prettyurl);
Code: Select all
// SEO URL Hack
$titleSEO = preg_replace("/[^\w-]+/", "-", $row['news_title']);
$categorySEO = preg_replace("/[^\w-]+/", "-", $row['news_category_name']);
$onerow->link = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, '', $sendtodetail,'', true, false,'',true, 'News/'.$categorySEO.'/'.($detailpage!=''?$detailpage:$titleSEO.'-'.$row['news_id']));
$onerow->titlelink = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, $row['news_title'], $sendtodetail,'',false,false,'',true,'News/'.$categorySEO.'/'.($detailpage!=''?$detailpage:$titleSEO.'-'.$row['news_id']));
$onerow->morelink = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, $moretext, $sendtodetail,'',false,false,'',true,'News/'.$categorySEO.'/'.($detailpage!=''?$detailpage:$titleSEO.'-'.$row['news_id']));
// SEO URL HACK
// $onerow->titlelink = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, $row['news_title'], $sendtodetail, '', false, false, '', true, $prettyurl);
// $onerow->morelink = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, $moretext, $sendtodetail, '', false, false, '', true, $prettyurl);
action.detail.php
Find
Code: Select all
$onerow->title = $row['news_title'];
Code: Select all
$this->news_title = $row['news_title'];
Find
Code: Select all
function SetParameters()
{
Code: Select all
// SEO URL hack
$this->RegisterRoute('/(?P<module>News)\/.*?\/.*\-(?P<articleid>[0-9]+)$/', array('returnid'=>'133'));
$this->RegisterRoute('/[nN]ews\/(?P<articleid>[0-9]+)\/(?P<returnid>[0-9]+)\/d,(?P<detailtemplate>.*?)$/');
$this->RegisterRoute('/[nN]ews\/(?P<articleid>[0-9]+)\/(?P<returnid>[0-9]+)\/d,(?P<detailtemplate>.*?)$/');
$this->RegisterRoute('/[nN]ews\/(?P<articleid>[0-9]+)\/(?P<returnid>[0-9]+)$/');
$this->RegisterRoute('/[nN]ews\/(?P<articleid>[0-9]+)$/');
$this->RegisterRoute('/[nN]ews\/(?P<action>rss)\/(?P<category>.*?)$/', array('showtemplate'=>'false'));
Find
Code: Select all
while ($dbresult && $row = $dbresult->FetchRow())
{
$onerow = new stdClass();
$sendtodetail = array('articleid'=>$row['news_id']);
$onerow->link = $this->CreateLink($id, 'detail', $returnid, '', $sendtodetail,'',true,false,'',true,'news/'.$row['news_id']);
$onerow->id = $row['news_id'];
$onerow->title = $row['news_title'];
$onerow->content = $row['news_data'];
$onerow->summary = $row['summary'];
$onerow->strippedcontent = strip_tags($onerow->content);
$onerow->strippedsummary = strip_tags($onerow->summary);
$onerow->postdate = $row['news_date'];
$onerow->gmdate = gmdate('r', $db->UnixTimeStamp($row['news_date']));
$onerow->startdate = $row['start_time'];
$onerow->enddate = $row['end_time'];
$onerow->category = $row['news_category_name'];
$entryarray[]= $onerow;
}
Code: Select all
while ($dbresult && $row = $dbresult->FetchRow())
{
$onerow = new stdClass();
$sendtodetail = array('articleid'=>$row['news_id']);
$titleSEO = preg_replace("/[^\w-]+/", "-", $row['news_title']);
$categorySEO = preg_replace("/[^\w-]+/", "-", $row['news_category_name']);
$onerow->link = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, '', $sendtodetail,'', true, false,'',true, 'News/'.$categorySEO.'/'.($detailpage!=''?$detailpage:$titleSEO.'-'.$row['news_id']));
//$onerow->link = $this->CreateLink($id, 'detail', $returnid, '', $sendtodetail,'',true,false,'',true,'news/'.$row['news_id']);
$onerow->id = $row['news_id'];
$onerow->title = $row['news_title'];
$onerow->content = $row['news_data'];
$onerow->summary = $row['summary'];
//$onerow->strippedcontent = strip_tags($onerow->content);
//$onerow->strippedsummary = strip_tags($onerow->summary);
$onerow->strippedcontent = $row['news_data'];
$onerow->strippedsummary = $row['summary'];
$onerow->postdate = $row['news_date'];
$onerow->gmdate = gmdate('r', $db->UnixTimeStamp($row['news_date']));
$onerow->startdate = $row['start_time'];
$onerow->enddate = $row['end_time'];
$onerow->category = $row['news_category_name'];
$entryarray[]= $onerow;
}
I've played with the spacing and code layout so you will have to look / search the files by hand, don't use an automated tool.
You will need the standard Pretty URL's .htaccess file and Pretty URL's already working for articles etc.
The hack also fixes the RSS feed for the new URLs's.
Both Old style URL's still work so SEO is not affected.
These files are from CMSMS version 1.2.3 "Black Rock" (upgraded from 1.2.2), on Apache and Red Hat with MySQL 5 back end (not that it should make a difference..)
I have not added the hack to take out the article number so URL's look like http://mysite.com/News/General/my-story-[b]12[/b].shtml, I did look at the code but it didn't work + I ran out of time to fix it.
if you want to see it working, have a look at http://www.avicraft.co.uk
Remember to make a backup of the files BEFORE you edit them, I normally copy the file to the same folder and append the date so action.default.php becomes action.default.php.210107, then edit the original file...
Let me know if you have a problem..
Regards
Courty

www.debinternet.co.uk - UK based CMSMS & Full Access Linux Webhosting, Site Design and Custom Coding..
Re: Search Engine Friendly URLS with News Module
Found a bug.. the Pretty URL's won't work if you have the directive {news detailpage="pagealias"} switched on, you need to just use {news} on the News page - other then that, custom templates appear to work (as long as you follow the normal coding)carasmo wrote: I did it too a while back, but I couldn't get the templates to work. So only the default, any other wouldn't work.
Please share what you did.
Courty

Last edited by Courty on Tue Jan 22, 2008 3:44 pm, edited 1 time in total.
www.debinternet.co.uk - UK based CMSMS & Full Access Linux Webhosting, Site Design and Custom Coding..
Re: Search Engine Friendly URLS with News Module
Courty,Courty wrote: I've played with the spacing and code layout so you will have to look / search the files by hand, don't use an automated tool.
You will need the standard Pretty URL's .htaccess file and Pretty URL's already working for articles etc.
The hack also fixes the RSS feed for the new URLs's.
Both Old style URL's still work so SEO is not affected.
These files are from CMSMS version 1.2.3 "Black Rock" (upgraded from 1.2.2), on Apache and Red Hat with MySQL 5 back end (not that it should make a difference..)
I have not added the hack to take out the article number so URL's look like http://mysite.com/News/General/my-story-[b]12[/b].shtml, I did look at the code but it didn't work + I ran out of time to fix it.
if you want to see it working, have a look at http://www.avicraft.co.uk
Remember to make a backup of the files BEFORE you edit them, I normally copy the file to the same folder and append the date so action.default.php becomes action.default.php.210107, then edit the original file...
Let me know if you have a problem..
Regards
Courty![]()
Thanks allot for that.. but just a few questions, i am in the process of setting up an online magazine styled website (content is based on the news module) now things are working fine, apart from the display of articles, what i get is just the "text" of an article displayed on a blank white page, so its not including the site template, any ideas?
Also, is it possible to remove the "news" out of the url. e.g instead of /news/cat/title i want /cat/title is this possible?
I am running cmsms "black rock"
thanks in advance
Dave
EDIT: changed page ID and it works nicely!!

Last edited by relic on Wed Apr 30, 2008 2:42 pm, edited 1 time in total.