I've been away for a bit but am now trying to get Pretty URLs resoved in 1.2.3.
I will explain what has been done so it helps people who might visit this later. Think things got a bit confusing
Changes to action.default.php
Code: Select all
//$prettyurl = 'news/'.$row['news_id'].'/'.($detailpage!=''?$detailpage:$returnid); <--------- commented out
$row['news_title'] = str_replace(' ', '_', $row['news_title']); // <------- added for pretty URL hack
$prettyurl = 'news/'.$row['news_id'].'/'.$row['news_title']; // <------- added for pretty URL hack
Code: Select all
#CreateLink($id, $action, $returnid='', $contents='', $params=array(), $warn_message='', $onlyhref=false, $inline=false, $addttext='', $targetcontentonly=false, $prettyurl='')
$row['news_title'] = str_replace('_', ' ', $row['news_title']); // <-------- added this line eveything else as 1.2.3
$onerow->link = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, '', $sendtodetail,'', true, false, '', true, $prettyurl);
$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);
$onerow->moreurl = $this->CreateLink($id, 'detail', $detailpage!=''?$detailpage:$returnid, $moretext, $sendtodetail, '', true, false, '', true, $prettyurl);
config settings
Code: Select all
#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';
#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism? This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = false;
#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy? (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = true;
#If using none of the above options, what should we be using for the query string
#variable? (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'page';
.htaccess now looks like this:-
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteBase /subfolder/
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.+).html %{REQUEST_URI}/ [R=301,L]
# rewrite for news
#RewriteRule ^([0-9]*).html$ index.php?mact=News,cntnt01,detail,0&cntnt01articleid=$1 [NC,L]
RewriteRule ^([0-9]*)/([0-9]*).html$ index.php?mact=News,cntnt01,detail,0&cntnt01articleid=$1&cntnt01returnid=$2 [NC,L]
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]
The links are being generated as
news/id/title_of_the_story.html
which is great, but I cannot get them to work! I get a 404 error.
I am using a localhost xampp install for testing purposes on windows.
I tried to use the .htaccess changes but that didnt work.
apache log reports:
[Wed Jan 16 10:39:51 2008] [warn] RewriteCond: NoCase option for non-regex pattern '-d' is not supported and will be ignored.
I have tried countless combinations - does anyone have any ideas?
Thanks -