Page 2 of 2

Posted: Mon 22. Mar 2004, 21:52
by Jan212
The Code is working...

Code: Select all

  else 
   { 
      // this is for mypage.html 
      $noid = substr($query,1); 
      $file = str_replace(",", ".", $noid).".html"; //further use 
   } 
   $link = "<a href=\"".$file."\""; 
   return($link); 
} 
place this after your else in the function url_search($query) and the chars shouldn't get lost...

Posted: Mon 22. Mar 2004, 22:03
by gent
if i change the front.func.inc.php from:

Code: Select all

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

Code: Select all

function url_search($query)
{
   if ( subStr($query,0,4) == "?id=") {
       $noid = substr($query, 4);
       $file = str_replace(",", ".", $noid).".html";
     } 
else 
    { 
       // this is for mypage.html 
       $noid = substr($query,1); 
       $file = str_replace(",", ".", $noid).".html"; //further use 
    } 
    $link = "<a href=\"".$file."\""; 
    return($link); 
 } 
then i get this error:

Code: Select all

Parse error: parse error in /usr/local/www/data.default/comodin/include/inc_front/front.func.inc.php on line 1204

Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/data.default/comodin/include/inc_front/front.func.inc.php:1204) in /usr/local/www/data.default/comodin/include/inc_front/content.func.inc.php on line 25

Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/data.default/comodin/include/inc_front/front.func.inc.php:1204) in /usr/local/www/data.default/comodin/include/inc_front/content.func.inc.php on line 26

Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/data.default/comodin/include/inc_front/front.func.inc.php:1204) in /usr/local/www/data.default/comodin/include/inc_front/content.func.inc.php on line 27

Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/data.default/comodin/include/inc_front/front.func.inc.php:1204) in /usr/local/www/data.default/comodin/include/inc_front/content.func.inc.php on line 28

Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/data.default/comodin/include/inc_front/front.func.inc.php:1204) in /usr/local/www/data.default/comodin/include/inc_front/content.func.inc.php on line 29

Fatal error: Call to undefined function: url_search() in /usr/local/www/data.default/comodin/index.php(71) : regexp code on line 1
and my .htaccess looks like this:

Code: Select all

php_flag magic_quotes_gpc Off
php_flag register_globals Off

RewriteEngine on 
RewriteBase /comodin 

# 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$ /comodin/index.php?id=$1.$2.$3.$4.$5.$6 

# This will rewrite mypage.html => index.php?mypage 
RewriteRule ^(.*)\.html$ /comodin/index.php?$1 

Posted: Mon 22. Mar 2004, 22:11
by Jan212
copy and paste the code from here plz - otherwise we'll getting trouble...

http://www.phpwcms.de/forum/viewtopic.p ... 9&start=15

Plz reply if it isn't working.

Posted: Mon 22. Mar 2004, 22:30
by gent
ok, sorry .. i found the error.

it was about copy/pasting the code from the browser to my editor.
i guess there was wrong linebreaks. by rebreaking all lines in my editor the code is now working.

and [ID contact]click here[/ID] is linking cerrectly to */contact.html

liebe grüsse an Jan212 .. danke für deine geduld :)

Posted: Mon 22. Mar 2004, 22:37
by ionrock
sweet... I am glad someone found an answer to that. I really needed it working

Posted: Mon 22. Mar 2004, 22:54
by Jan212
no problem - kein problem danke für die grüße...

ja unix und windows zeilenumbrüche sind ein unterschied, besonders in der .htaccess beachten beim WAMP 2 LAMP Export, das ist mir auch schon zum verhängniss geworden...

For everyone who has a 404 or on internal server error while tryin to use the rewrite func.
set up
+FollowSymLinks and
AllowOverride All
in your apache config...

PACE...

Posted: Sun 25. Apr 2004, 22:21
by argos
Works like a charm! Thank you.

Posted: Fri 4. Jun 2004, 22:48
by brans
I think the only problem can be the settings that are mentioned above..

=> "If you have an 404 ..."

because the settings are all right, alle the links are being created correctly but I always get a 404 Error. :-(

But how can I find out if these settings are set correctly or not if I don't have root acces nor shell access ? Do I have to email my provider ?

And does this hack work with RC2 or not ?

Posted: Fri 4. Jun 2004, 22:53
by Jan212
hi,
please use the newest version
http://sourceforge.net/projects/phpwcms

Posted: Sun 6. Jun 2004, 14:06
by brans
of course I got that version! But on one of my projects there is still running RC2 and if not absolutely necessary I don't want to update, because RC2 is absolutely sufficient.

Posted: Fri 25. Jun 2004, 11:51
by Chucky
geht das auch in deutsch ? :-) versteh ja kein einziges wort :P

Posted: Tue 30. Nov 2004, 18:31
by Nate
How can I configure RewriteEngine in .htaccess to not rewrite specific directories (I have other scripts running that I don't want their url's rewritten)?

Posted: Wed 1. Dec 2004, 20:56
by leone
Nice mod and after compiling the apache with the rewrite mod I got it working finally.

I have however had to change the function (url_search)

The line containing this

Code: Select all

$link = "<a href=\"".$file."\""; 
to:

Code: Select all

$link = " href=\"".$file."\""; 
As I was getting menus containing "<a<a href ..." in the Sourcecode for the clickable links. So some menus did not even appear as clickable, {NAV_ROW} menus would not show clickable links. Using the second version then solved that problem.

Btw, my pages have the extension .phtml. I have not found a way for them to use the .html extension. So also had to adopt the entries in the .htaccess accordingly.

Any ideas?

regards,

leone

Posted: Fri 3. Dec 2004, 01:58
by Nate
Actually, I should rephrase my question:

Do subdirectories inherit the rewrite rules of the parent directory?