Hello everybody,
1.
The rewrite function is definitly working with all releases, include the releas fom the 04-04-2004.
I have it running on every version.
2.The function is included in the next release (guaranteed) and it doesn't have to be enhanced because it's working perfect.
in your case the problem perhaps is that you named your .htaccess ->
.htacess -> first mistake
or 2nd reason because of the missing
or the 3rd reason could be because you've cut out the function js_url_search($query) after the function url_search
Code: Select all
//Rewrite functions / modded 02.03.04
function url_search($query)
{
if ( subStr($query,0,4) == "?id=")
{
// this is for id=0,0,0,0,0
$noid = substr($query, 4);
$file = str_replace(",", ".", $noid).".html"; //further use
}
else
{
// this is for mypage.html
$noid = substr($query,1);
$file = str_replace(",", ".", $noid).".html"; //further use
}
$link = "<a href=\"".$file."\"";
return($link);
}
function js_url_search($query)
{
$noid = substr($query, 4);
$file = str_replace(",", ".", $noid).".html"; //further use
//$file = $noid.".html";
$link = "onClick=\"location.href='".$file."'";
return($link);
//unset($link);
}
// -------------------------------------------------------------
And now I'm rocking...
REWRITE FOR DUMMIES II
Change the function url_search in front.func.inc.php
Code: Select all
function url_search($query)
{
if ( subStr($query,0,4) == "?id=")
{
// this is for id=0,0,0,0,0
$noid = substr($query, 4);
$file = str_replace(",", ".", $noid).".html"; //further use
}
else
{
// this is for mypage.html
$noid = substr($query,1);
$file = str_replace(",", ".", $noid).".html"; //further use
}
$link = "<a href="".$file.""";
return($link);
}
In .htaccess
Code: Select all
RewriteEngine on
# if you're in a subdirectory named "beta" add the rewriteBase
#RewriteBase /beta
# This will rewrite 0.0.0.0.0.html => index.php?id=0.0.0.0.0
RewriteRule ^([0-9]*).([0-9]*).([0-9]*).([0-9]*).([0-9]*).([0-9]*).html$ /index.php?id=$1.$2.$3.$4.$5.$6
# This will rewrite mypage.html => index.php?mypage
RewriteRule ^(.*).html$ /index.php?$1
EXAMPLE:
You call your Site like
http://www.example.com/mysubdir/index.php
You need to modify the rules as followed:
Code: Select all
RewriteEngine on
RewriteBase /mysubdir
# This will rewrite 0.0.0.0.0.html => index.php?id=0.0.0.0.0
RewriteRule ^([0-9]*).([0-9]*).([0-9]*).([0-9]*).([0-9]*).([0-9]*).html$ /mysubdir/index.php?id=$1.$2.$3.$4.$5.$6
# This will rewrite mypage.html => index.php?mypage
RewriteRule ^(.*).html$ /mysubdir/index.php?$1
logging the rewrite, ad this to the .htaccess
Code: Select all
RewriteLog "/absolute/path/to/the/rewrite.log"
# 0 = Logging disabled, 9 = highest level of logging, only for debugging
RewriteLogLevel 3
If you have installed my Quick-Hack for rewriting this next hack should be also fine for you: Using Alias-Names in the Navigation
File: /include/inc_front/front.func.inc.php
Line: 511
function name: get_struct_data
desc:We will add the "acat_alias" to the struct wich is used for building the menu. I did this at the end of each field-list. You can copy the complete function from here
Code: Select all
function get_struct_data ($dbcon, $root_name="Home", $root_info="") {
//returns the complete active and public struct data as array
//so it is reusable by many menu functions -> lower db access
$data[0] = array( "acat_id" => 0,
"acat_name" => $root_name,
"acat_info" => $root_info,
"acat_struct" => 0,
"acat_sort" => 0,
"acat_hidden" => 0,
"acat_regonly" => 0,
"acat_ssl" => 0,
"acat_template" => 0 ,
"acat_alias" => 0
);
$sql = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecat WHERE ".
"acat_aktiv=1 AND acat_public=1 AND acat_trash=0 ORDER BY acat_struct, acat_sort;";
if($result = mysql_query($sql, $dbcon)) {
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$data[$row["acat_id"]] = array( "acat_id" => $row["acat_id"],
"acat_name" => $row["acat_name"],
"acat_info" => $row["acat_info"],
"acat_struct" => $row["acat_struct"],
"acat_sort" => $row["acat_sort"],
"acat_hidden" => $row["acat_hidden"],
"acat_regonly" => $row["acat_regonly"],
"acat_ssl" => $row["acat_ssl"],
"acat_template" => $row["acat_template"],
"acat_alias" => $row["acat_alias"],
);
}
mysql_free_result($result);
}
return (sizeof($data)) ? $data : array();
}
File: /include/inc_front/front.func.inc.php
Line: 669
function name: build_levels
desc:In line 705 we will change the var $link to prepare for using aliase. You can copy this line from here. I left the original untouched to have the chanche to go back
Code: Select all
// $link = $link_to."?id=".$key.",0,0,1,0,0";
$link = $link_to."?".$struct[$key]['acat_alias'];
--------------------------------------------------------------------------------------
PACE