1 (edited by 2009-07-28 20:32:37)

Topic: [HACK] Search Engine Friendly URLs - Mod Rewrite

Name: Mod-Rewrite
Author: FI-DD & Ifa
CuteNews Compatibility: 1.3.6 - 1.4.1
Description: Here is two versions of mod rewrites. The mod_rewrite2.txt is the original Mod Rewrite v2 by FI-DD, and the mod_rewrite2mod.txt is the same, with small modifications by me. The original gives you a url of "post/news-title-like-this.html" as for mine, its "post/category/news-title-like-this-newsid.html
Discussion Topic: here & here
Instructions:

My version can have two articles of the same name, but the original might have a problem with it. But if you don't mind not having articles with the same names, I recommend the original version.

Both files come with good instructions on how to install the hack.

[Edit by StealthEye]
Since some people were having trouble downloading the attachments, I uploaded them somewhere else:
http://www.xs4all.nl/~cvdtak/mod_rewrite2.txt FI-DD
http://www.xs4all.nl/~cvdtak/mod_rewrite2mod.txt Ifa

2 (edited by 2010-05-29 15:53:37)

Re: [HACK] Search Engine Friendly URLs - Mod Rewrite

Name: Mod-Rewrite by Ifa
Author: FUNimations
CuteNews Compatibility: 1.4.5 - * (no incompatibilty reported yet)
Description: Since the coming of articles in multiple categories, this hack has a flaw when an article is posted in multiple categories. If you're not aware of this yet, please have a look at the bug list at the start of the faq forum. Multiple categories is buggy in all known CuteNews versions that have the 'multiple category' option. Now this fix is ONLY for Ifa's mod_rewrite. FI-DD's versions (see another FAQ for his list) doesn't have this problem.
Instructions:
install the above hack by Ifa

In step 4 you'll need to add this line of code as part of a function. find

foreach ($all_cats as $cats_line)
                {
                    $cats_arr = explode("|", $cats_line);
                    if ($cats_arr[0] == $news_arr[6]) $category = ereg_replace("[^[:alnum:] ]", "-", $cats_arr[1]);
                }


replace it with

    if( $cat_news_arr = explode( ',', $news_arr[6] ) )
    {
        $category = array();
        foreach ($all_cats as $cats_line)
                {
                    $cats_arr = explode("|", $cats_line);
                    if ( in_array( $cats_arr[0], $cat_news_arr )) $category[] = ereg_replace("[^[:alnum:] ]", "-", $cats_arr[1]);
                }
        $category = implode( '_', $category );
    }
    else
    {
        foreach ($all_cats as $cats_line)
                {
                    $cats_arr = explode("|", $cats_line);
                    if ($cats_arr[0] == $news_arr[6]) $category = ereg_replace("[^[:alnum:] ]", "-", $cats_arr[1]);
                }
    }

And don't forget to do the bugfix posted at the start of the FAQ forum.