bug in rewrite url

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Moozie
Posts: 164
Joined: Sat 8. Nov 2003, 00:21
Location: Netherlands

Post by Moozie »

Yes the url is OK in the menu. But if you enter in the content (ARTICLE) a link like:

Code: Select all

[id kontakt]click for page kontakt[/id]
Then the fronmtend does not show a lionk to kontakt.html, does it?
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

didn't test it - one moment...
Repute
Posts: 45
Joined: Mon 10. Nov 2003, 16:32
Location: Netherlands
Contact:

Post by Repute »

I hope comes an change soon coase it's just an great feature the search engines love it ;)... But the html editors in phpwcms don't :S

Greets,

Repute
Image
http://www.repute.nl the official phpwcms dutch translator!
Also check http://www.chihuahua-club.nl
Inets
Posts: 6
Joined: Tue 25. Nov 2003, 07:18

Alias

Post by Inets »

I have problem with links like [ID link] goto [/ID]

When I change rewrite url_search func in front.func.inc with:

//Rewrite functions
function url_search($query)
{
if(strpos($query, "id")) $noid = substr($query, 4);
else $noid = substr($query, 1);
$file = str_replace(",", ".", $noid).".html"; //further use
//$file = $noid.".html";
$link = "<a href=\"".$file."\"";
return($link);
//unset($link);
}

Its really works.

.htaccess file likes this

php_flag magic_quotes_gpc Off
php_flag register_globals Off

RewriteEngine on
RewriteRule ^(.*).html$ ./index.php?id=$1
RewriteRule ^index.html$ ./index.php
Moozie
Posts: 164
Joined: Sat 8. Nov 2003, 00:21
Location: Netherlands

Post by Moozie »

I tried your suggestion, but the same problems are there.

For your information:
1. I make a page in admin and give it the alias "page_7"
2. In article I say: [ID page_7] goto page 7[/ID]

What happens is that tje link goes to "page_7.html", but when I click it it goed toe the homepage, so this is the index page. Only the links in the nav-table works correct, but there the links are typed as "0.33.0.0.1.html" instead of "page_7.html".

Can you confirm that when you write: problem with links like [ID link] goto [/ID],you mean that "link" means ALIAS?
gent
Posts: 163
Joined: Tue 16. Dec 2003, 13:51
Location: Berlin

Post by gent »

Moozie wrote: 2. In article I say: [ID page_7] goto page 7[/ID]

i use [INT page_7.html]goto page 7[/INT]

or is there a other solution?
or is the bug fixed?
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

[ID alias]Link[/ID]
Regards/ Grüsse/ Groetjes - JAN212
------------------------------------------------
null212 - Büro für Kommunikation und Design
------------------------------------------------
Lyrikfetzen des Tages
1. Ist der Quelltext auch valide fragt Herr Müller ganz perfide.
2. Wat is dat een lekker ding.
3. Wer Vision hat soll zum Arzt gehen.
------------------------------------------------
gent
Posts: 163
Joined: Tue 16. Dec 2003, 13:51
Location: Berlin

Post by gent »

Jan212 wrote:[ID alias]Link[/ID]
this link will be */as.html , cause the first 3 chars will be lost.
ionrock
Posts: 279
Joined: Fri 20. Feb 2004, 17:04

Post by ionrock »

I had the same issue and have not had time to mess with it. But if someone else is having trouble I also would like to know a solution. :)
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

it works if you install pixelpeters mods... i've tested it 2 minutes ago.

front.func.inc.php

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); 
} 

here goes the .htaccess code

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off
DirectoryIndex index.php
RewriteEngine on 
RewriteBase /phpwcms/
# 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$ /phpwcms/index.php?id=$1.$2.$3.$4.$5.$6
# This will rewrite mypage.html => index.php?mypage 
RewriteRule ^([a-zA-Z0-9_]*)\.html$ /phpwcms/index.php?$1
Regards/ Grüsse/ Groetjes - JAN212
------------------------------------------------
null212 - Büro für Kommunikation und Design
------------------------------------------------
Lyrikfetzen des Tages
1. Ist der Quelltext auch valide fragt Herr Müller ganz perfide.
2. Wat is dat een lekker ding.
3. Wer Vision hat soll zum Arzt gehen.
------------------------------------------------
gent
Posts: 163
Joined: Tue 16. Dec 2003, 13:51
Location: Berlin

Post by gent »

sorry but again, i tested it again and again by copy/pasting ur code and pixelpeters code .. and sorry it dont work.

the error i get is posted here: http://www.phpwcms.de/forum/viewtopic.php?p=7189#7189
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

Ok- everything works now... or am i wrong?
Regards/ Grüsse/ Groetjes - JAN212
------------------------------------------------
null212 - Büro für Kommunikation und Design
------------------------------------------------
Lyrikfetzen des Tages
1. Ist der Quelltext auch valide fragt Herr Müller ganz perfide.
2. Wat is dat een lekker ding.
3. Wer Vision hat soll zum Arzt gehen.
------------------------------------------------
gent
Posts: 163
Joined: Tue 16. Dec 2003, 13:51
Location: Berlin

Post by gent »

all is working well ... thx

ganz lieben dank nochmal :)
Jan212
Posts: 859
Joined: Wed 28. Jan 2004, 21:38
Location: Solingen
Contact:

Post by Jan212 »

kein problem :wink: zum zwoten...

check out the newest movie i had in my brain

http://www.magentaliebe.de
Regards/ Grüsse/ Groetjes - JAN212
------------------------------------------------
null212 - Büro für Kommunikation und Design
------------------------------------------------
Lyrikfetzen des Tages
1. Ist der Quelltext auch valide fragt Herr Müller ganz perfide.
2. Wat is dat een lekker ding.
3. Wer Vision hat soll zum Arzt gehen.
------------------------------------------------
Florian
Posts: 119
Joined: Wed 19. Nov 2003, 16:50
Location: Hamburg
Contact:

Post by Florian »

Hello guys!

After upgrading to RC-3 I've got several problems with the mod_rewrite function.

At first by default the mod_rewrite is set to *.shtml endings. Thats for some of us quite a problem, because the Apaches are set by default to .htm, .html and so one, but NOT to .shtml. So you have to access the front.func.inc.php and comment / uncomment the affected lines within the REWRITE function of Jan212.
On the other hand I have the problem, that the rewrite does not the whole job. The function doesn't rewrite "?flag" given links to "flag.html". For example: http://www.inokoo.de/0.1.0.0.1.0.html?kontakt is the result.

So here's my .htaccess config

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off




# Rewrite functionality for phpwcms
# optimized by Jan212
# 18-04-2004

#DirectoryIndex index.html index.php 
RewriteEngine On


# IF PHPWCMS IS INSTALLED IN YOUR WEB ROOT

# This will rewrite 0.0.0.0.0.0.shtml => index.php?id=0.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


# If phpwcms is installed in a subdirectory,
# sample: "phpwcms" then use this (remove #)
# ===============================================
#RewriteBase /inoko

# This will rewrite 0.0.0.0.0.0.shtml => index.php?id=0.0.0.0.0.0
#RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.shtml$ /inoko/index.php?id=$1.$2.$3.$4.$5.$6

# This will rewrite index-mypage.shtml => index.php?mypage 
#RewriteRule ^(.+)\.shtml$ /inoko/index.php?$1 



#THIS IS FOR REWRITE LOGGING 
#RewriteLog "/absolute/path/to/the/rewrite.log" 
# 0 = Logging disabled, 9 = highest level of logging, only for debugging 
#RewriteLogLevel 3


And this is the function in front.func.inc.php

Code: Select all

// REWRITE - PATCHED FOR 04/04 // jan212
function url_search($query) { 
	if ( substr($query,0,4) == '?id=') { 
		$noid = substr($query, 4); 
		$file = str_replace(',', '.', $noid).'.html'; 
		//$file = str_replace(',', '.', $noid).'.shtml'; 
	} else { 
		$noid = substr($query,1); 
		$file = str_replace(',', '.', $noid).'.html'; 
		//$file = str_replace(',', '.', $noid).'.shtml';
		/*
		//get category name
		$s = $GLOBALS['content']['struct'][ $GLOBALS['content']['cat_id'] ]['acat_name'];
		if($s) {
			$s = str_replace(' ', '-', $s);
			$s = str_replace('_', '-', $s);
			$s = remove_accents($s);
			$file = $s.'_'.$file;
		}
		*/
	} 
	$link = '<a href="'.$file.'"'; 
	return($link); 
} 

function js_url_search($query) { 
	if ( substr($query,0,4) == '?id=') { 
		$noid = substr($query, 4);
		$file = str_replace(',', '.', $noid).'.html'; 
		//$file = str_replace(',', '.', $noid).'.shtml'; 
	} else { 
		$noid = substr($query,1); 
		$file = str_replace(',', '.', $noid).'.html';
		//$file = str_replace(',', '.', $noid).'.shtml';
		/*
		//get category name
		$s = $GLOBALS['content']['struct'][ $GLOBALS['content']['cat_id'] ]['acat_name'];
		if($s) {
			$s = str_replace(' ', '-', $s);
			$s = str_replace('_', '-', $s);
			$s = remove_accents($s);
			$file = $s.'_'.$file;
		}
		*/
	} 
	$link = "onClick=\"location.href='".$file."'"; 
	return($link); 
} 

// -------------------------------------------------------------
Any suggestions to me, please :D .

Cheers,
Florian
Post Reply