Seite 3 von 26

Verfasst: 06.01.2005 14:15
von Dogi
@ larsneo
es hängt sicherlich vom traffic auf dem jeweiligen board ab - low & mid frequency sollte auch in shared hosting eigentlich kein problem sein
... dazu mal eine Frage was verstehst du unter "low & mid frequency" Foren, z.B. meins hat am Tag ca. 250 - 350 Besucher und erzeugt am Tag ca. 3500 - 4000 PI.
Fällt es in Deine Definition denn ich würde Deine neue Variante der Short Urls gerne nutzen nur ich weiß nicht ob mich dann mein Provider irgend wann kickt?
Übrigens Deine alte Variante benutze ich und hatte in kurzer Zeit großen Erfolg bei Google :grin:

Danke für eine Antwort auf meine Frage.

Verfasst: 11.01.2005 20:16
von speedy00
larsneo hat geschrieben:wer lust hat kann ja einmal ein performance-metering auf das preg_replace innerhalb des output-buffers laufen lassen ;-)
Wenn de mir das jetzt noch erklärst "auf Deutsch" dann währ das prima. :)
bzw sag mir mal in verständlichen Worten wie ich das anstell.

Verfasst: 11.01.2005 21:48
von larsneo
man müsste in einem (zumindesten halbwegs definierten und gleichbleibendem) umfeld die auswirkungen des rewritings (also die anpassungen in der /includes/page_header.php sowie die .htaccess) auf die ladezeit der seite abprüfen; damit das ganze dann auch zumindestens halbwegs aussagekräftig ist, müsste die testreihe oft genug wiederholt werden...

ich persönliche hatte bislang nie probleme mit dem rewriting, meine grösseren installationen (>75 benutzer parallel) sind allerdings auch auf dedicated servern untergebracht, von daher habe ich mich nie mit dem performance-metering beschäftigt :roll:

Verfasst: 21.01.2005 18:00
von BraveEagle
wenn ich die änderungen in der page_header mache kommt der Fehler:

Code: Alles auswählen

Parse error: parse error, unexpected $ in /www/htdocs/bcforum/includes/page_header.php on line 462
Hier ist die Datei

Verfasst: 22.01.2005 13:50
von larsneo
hinter dem schliessenden ?> tag hast du noch eine ganze menge zeugs am ende der datei, das da definitv nicht hingehört...

Verfasst: 22.01.2005 14:08
von BraveEagle
jetzt frag mich nicht wie das da hinkommt (vermute mal auf nen älteren Mod). Aber in der alten overall_header funzt das alles so perfekt. Nur wenn ich den Code einfüge kommt die Fehlermeldung.

Nur um sicher zu sein ich muss ja das

Code: Alles auswählen

//
// Short URL implementation
//
// start buffering
ob_start();

function replace_for_mod_rewrite(&$s) {
// get the correct base_url: protocoll,url,path to make sure to rewrite only internal links
if (empty($HTTP_SERVER_VARS['HTTP_HOST'])) {
   $server = getenv('HTTP_HOST');
} else {
   $server = $HTTP_SERVER_VARS['HTTP_HOST'];
}
// IIS sets HTTPS=off
if (isset($HTTP_SERVER_VARS['HTTPS']) && $HTTP_SERVER_VARS['HTTPS'] != 'off') {
   $proto = 'https://';
} else {
   $proto = 'http://';
}
// Get the name of this URI
// Start of with REQUEST_URI
if (isset($HTTP_SERVER_VARS['REQUEST_URI'])) {
   $path = $HTTP_SERVER_VARS['REQUEST_URI'];
} else {
   $path = getenv('REQUEST_URI');
}
if ((empty($path)) || (substr($path, -1, 1) == '/')) {
   // REQUEST_URI was empty or pointed to a path
   // Try looking at PATH_INFO
   $path = getenv('PATH_INFO');
   if (empty($path)) {
      // No luck there either
      // Try SCRIPT_NAME
      if (isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) {
         $path = $HTTP_SERVER_VARS['SCRIPT_NAME'];
      } else {
         $path = getenv('SCRIPT_NAME');
      }
   }
}

$path = preg_replace('/[#\?].*/', '', $path);
$path = dirname($path);

if (preg_match('!^[/\\\]*$!', $path)) {
   $path = '';
}

$base_url = "$proto$server$path/";
$prefix = '|"(?:'.$base_url.')?';
// now that we know about the correct $prefix we can start the rewriting

$urlin =
array(
$prefix . '(?<!/)index.php"|',
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=([0-9]*)&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=previous"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=next"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)highlight=([a-zA-Z0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)"|',
);
$urlout = array(
'"forums.html"',
'"viewforum\\1-\\2-\\3.html"',
'"forum\\1.html"',
'"ptopic\\1.html"',
'"ntopic\\1.html"',
'"ftopic\\1-\\2-\\3-\\4.html"',
'"ftopic\\1.html"',
'"ftopic\\1-\\2.html"',
'"ftopic\\1.html"',
);

$s = preg_replace($urlin, $urlout, $s);
return $s;
}
durch das

Code: Alles auswählen


//
// start Short URL implementation [larsneo]
//
// start buffering
ob_start();

function replace_for_mod_rewrite(&$s) {
// get the correct base_url: protocoll,url,path to make sure to rewrite only internal links
if (empty($HTTP_SERVER_VARS['HTTP_HOST'])) {
   $server = getenv('HTTP_HOST');
} else {
   $server = $HTTP_SERVER_VARS['HTTP_HOST'];
}
// IIS sets HTTPS=off
if (isset($HTTP_SERVER_VARS['HTTPS']) && $HTTP_SERVER_VARS['HTTPS'] != 'off') {
   $proto = 'https://';
} else {
   $proto = 'http://';
}
// Get the name of this URI
// Start of with REQUEST_URI
if (isset($HTTP_SERVER_VARS['REQUEST_URI'])) {
   $path = $HTTP_SERVER_VARS['REQUEST_URI'];
} else {
   $path = getenv('REQUEST_URI');
}
if ((empty($path)) || (substr($path, -1, 1) == '/')) {
   // REQUEST_URI was empty or pointed to a path
   // Try looking at PATH_INFO
   $path = getenv('PATH_INFO');
   if (empty($path)) {
      // No luck there either
      // Try SCRIPT_NAME
      if (isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) {
         $path = $HTTP_SERVER_VARS['SCRIPT_NAME'];
      } else {
         $path = getenv('SCRIPT_NAME');
      }
   }
}

$path = preg_replace('/[#\?].*/', '', $path);
$path = dirname($path);

if (preg_match('!^[/\\\]*$!', $path)) {
   $path = '';
}

$base_url = "$proto$server$path/";
$prefix = '|"(?:'.$base_url.')?';
// now that we know about the correct $prefix we can start the rewriting

$urlin =
array(
$prefix . '(?<!/)index.php\?mark=forums"|',
$prefix . '(?<!/)index.php"|',
$prefix . '(?<!/)index.php\?c=([0-9]*)"|',
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=0&(?:amp;)start=0"|',
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=0&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=([0-9]*)&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)mark=topics"|',
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)highlight="|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=previous"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=next"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)highlight=([a-zA-Z0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=0&(?:amp;)postorder=asc&(?:amp;)start=0"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=0&(?:amp;)postorder=asc&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=0"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?p=([0-9]*)&(?:amp;)highlight=#([0-9]*)"|',
$prefix . '(?<!/)viewtopic.php\?p=([0-9]*)#([0-9]*)"|',
$prefix . '(?<!/)posting.php\?mode=newtopic&(?:amp;)f=([0-9]*)"|',
$prefix . '(?<!/)posting.php\?mode=reply&(?:amp;)t=([0-9]*)"|',
$prefix . '(?<!/)posting.php\?mode=([a-z]*)&(?:amp;)p=([0-9]*)"|',
$prefix . '(?<!/)album.php"|',
$prefix . '(?<!/)album_personal_index.php"|',
$prefix . '(?<!/)album_personal.php\?user_id=([0-9]*)"|',
$prefix . '(?<!/)profile.php\?mode=viewprofile&(?:amp;)u=([0-9]*)"|',
$prefix . '(?<!/)search.php\?search_author=([[:alnum:]%+\.]+)"|',
$prefix . '(?<!/)search.php\?search_id=([0-9]*)&(?:amp;)start=([0-9]*)"|',
$prefix . '(?<!/)search.php\?search_id=([a-zA-Z]*)"|',
$prefix . '(?<!/)privmsg.php\?mode=([a-zA-Z]*)&(?:amp;)u=([0-9]*)"|',
$prefix . '(?<!/)privmsg.php\?folder=([a-zA-Z]*)"|',
$prefix . '(?<!/)profile.php\?mode=register&(?:amp;)agreed=true"|',
$prefix . '(?<!/)profile.php\?mode=([0-9a-zA-Z]*)"|',
$prefix . '(?<!/)map.php\?highlight=([0-9]*)"|',
$prefix . '(?<!/)map.php"|',
$prefix . '(?<!/)faq.php"|',
$prefix . '(?<!/)search.php"|',
$prefix . '(?<!/)memberlist.php"|',
$prefix . '(?<!/)groupcp.php"|',
$prefix . '(?<!/)report.php"|',
$prefix . '(?<!/)viewonline.php"|',
);
$urlout = array(
'"index-mark.html"',
'"index.html"',
'"category\\1.html"',
'"forum\\1.html"',
'"forum\\1-\\2.html"',
'"forum\\1-\\2-\\3.html"',
'"forum\\1-mark.html"',
'"forum\\1.html"',
'"ftopic\\1.html"',
'"ptopic\\1.html"',
'"ntopic\\1.html"',
'"ftopic\\1.html"',
'"ftopic\\1.html"',
'"ftopic\\1-\\2.html"',
'"ftopic\\1-\\2-\\3-\\4.html"',
'"ftopic\\1.html"',
'"ftopic\\1-\\2.html"',
'"ftopic\\1.html"',
'"fpost\\1.html#\\2"',
'"fpost\\1.html#\\2"',
'"post-newtopic-\\1.html"',
'"post-reply-\\1.html"',
'"post-\\1-\\2.html"',
'"album.html"',
'"palbum.html"',
'"palbum\\1.html"',
'"profile\\1.html"',
'"search-author-\\1.html"',
'"search-\\1-\\2.html"',
'"search-\\1.html"',
'"privmsg-\\1-\\2.html"',
'"privmsg-\\1.html"',
'"register.html"',
'"profile-\\1.html"',
'"map-\\1.html"',
'"map.html"',
'"faq.html"',
'"search.html"',
'"memberlist.html"',
'"groups.html"',
'"report.html"',
'"online.html"',
);

$s = preg_replace($urlin, $urlout, $s);
return $s;
}
//
// end Short URL implementation [larsneo]
//
ersetzen

*edit*

hmm heute scheint es mit der gleichen Datei, mit der ich diese Fehlermeldung hatte zu funzen.... da versteh einer die Welt :-?

Verfasst: 30.01.2005 17:30
von Sven_R
Hallo

1. Das ist ein SUPER mod
2. ich habe ein kleines problem.

ich hab alles eingebaut wo es hingeört
da ich zu test zwecken einen eigenen apache webserver zu hause laufen hab, konnte ich alles zum laufen bringen.


aber das phpbb schreibt kommischer weise nichts allein um.
ich kann zwar über die Eingabezeile im Browser auf alle Rewrites korrekt
zugreifen, aber phpbb zeig mit nicht die korrekten Links, wenn ich mit der mouse auf dem Link bin.

ich hab auch keine nennenswerten fehler im apache rewrite.log gefunden

kann mir da jemand weiter helfen.
ich bin da ziemlich ratlos

Achja, ich hab die phpbb versionen 2.0.8 und 2.0.11 probiert.

cu

Verfasst: 30.01.2005 17:51
von larsneo
aber das phpbb schreibt kommischer weise nichts allein um.
...dann ist wahrscheinlich die /includes/page_header.php nicht korrekt angepasst

Verfasst: 30.01.2005 18:24
von Sven_R
hallo

also die htaccess hab ich für meinen apachen angepasst.

und in der page_tail.php hab ich laut anleitung

Code: Alles auswählen

// 
// Short URL implementation 
// 
$contents = ob_get_contents(); 
ob_end_clean(); 
echo replace_for_mod_rewrite($contents);
//
// End Short URL 
nach

Code: Alles auswählen

//
// Close our DB connection.
//
$db->sql_close();
eingebaut.

und nach

Code: Alles auswählen

$gzip_contents = ob_get_contents();
hab ich laut anleitung

Code: Alles auswählen

// 
// Short URL implementation 
// 
	$gzip_contents = replace_for_mod_rewrite($gzip_contents);	
//
// End Short URL
//	
und in die page_header.php ab ich vor

Code: Alles auswählen

//
// Generate logged in/logged out status
//
das eingebaut

Code: Alles auswählen

// 
// start Short URL implementation [larsneo] 
// 
// start buffering 
ob_start(); 
 
function replace_for_mod_rewrite(&$s) { 
// get the correct base_url: protocoll,url,path to make sure to rewrite only internal links 
if (empty($HTTP_SERVER_VARS['HTTP_HOST'])) { 
$server = getenv('HTTP_HOST'); 
} else { 
$server = $HTTP_SERVER_VARS['HTTP_HOST']; 
} 
// IIS sets HTTPS=off 
if (isset($HTTP_SERVER_VARS['HTTPS']) && $HTTP_SERVER_VARS['HTTPS'] != 'off') { 
$proto = 'https://'; 
} else { 
$proto = 'http://'; 
} 
// Get the name of this URI 
// Start of with REQUEST_URI 
if (isset($HTTP_SERVER_VARS['REQUEST_URI'])) { 
$path = $HTTP_SERVER_VARS['REQUEST_URI']; 
} else { 
$path = getenv('REQUEST_URI'); 
} 
if ((empty($path)) || (substr($path, -1, 1) == '/')) { 
// REQUEST_URI was empty or pointed to a path 
// Try looking at PATH_INFO 
$path = getenv('PATH_INFO'); 
if (empty($path)) { 
// No luck there either 
// Try SCRIPT_NAME 
   if (isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) { 
      $path = $HTTP_SERVER_VARS['SCRIPT_NAME']; 
   } else { 
	 $path = getenv('SCRIPT_NAME'); 
	} 
    } 
} 
 
$path = preg_replace('/[#\?].*/', '', $path); 
$path = dirname($path); 

if (preg_match('!^[/\\\]*$!', $path)) { 
$path = ''; 
} 

$base_url = "$proto$server$path/"; 
$prefix = '|"(?:'.$base_url.')?'; 
// now that we know about the correct $prefix we can start the rewriting 

$urlin = 
array( 
$prefix . '(?<!/)index.php\?mark=forums"|', 
$prefix . '(?<!/)index.php"|', 
$prefix . '(?<!/)index.php\?c=([0-9]*)"|', 
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=0&(?:amp;)start=0"|', 
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=0&(?:amp;)start=([0-9]*)"|', 
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)topicdays=([0-9]*)&(?:amp;)start=([0-9]*)"|', 
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)&(?:amp;)mark=topics"|', 
$prefix . '(?<!/)viewforum.php\?f=([0-9]*)"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)highlight="|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=previous"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)view=next"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)highlight=([a-zA-Z0-9]*)"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=0&(?:amp;)postorder=asc&(?:amp;)start=0"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=0&(?:amp;)postorder=asc&(?:amp;)start=([0-9]*)"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)postdays=([0-9]*)&(?:amp;)postorder=([a-zA-Z]*)&(?:amp;)start=([0-9]*)"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=0"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)&(?:amp;)start=([0-9]*)"|', 
$prefix . '(?<!/)viewtopic.php\?t=([0-9]*)"|', 
$prefix . '(?<!/)viewtopic.php\?p=([0-9]*)&(?:amp;)highlight=#([0-9]*)"|', 
$prefix . '(?<!/)viewtopic.php\?p=([0-9]*)#([0-9]*)"|', 
$prefix . '(?<!/)posting.php\?mode=newtopic&(?:amp;)f=([0-9]*)"|', 
$prefix . '(?<!/)posting.php\?mode=reply&(?:amp;)t=([0-9]*)"|', 
$prefix . '(?<!/)posting.php\?mode=([a-z]*)&(?:amp;)p=([0-9]*)"|', 
$prefix . '(?<!/)album.php"|', 
$prefix . '(?<!/)album_personal_index.php"|', 
$prefix . '(?<!/)album_personal.php\?user_id=([0-9]*)"|', 
$prefix . '(?<!/)profile.php\?mode=viewprofile&(?:amp;)u=([0-9]*)"|', 
$prefix . '(?<!/)search.php\?search_author=([[:alnum:]%+\.]+)"|', 
$prefix . '(?<!/)search.php\?search_id=([0-9]*)&(?:amp;)start=([0-9]*)"|', 
$prefix . '(?<!/)search.php\?search_id=([a-zA-Z]*)"|', 
$prefix . '(?<!/)privmsg.php\?mode=([a-zA-Z]*)&(?:amp;)u=([0-9]*)"|', 
$prefix . '(?<!/)privmsg.php\?folder=([a-zA-Z]*)"|', 
$prefix . '(?<!/)profile.php\?mode=register&(?:amp;)agreed=true"|', 
$prefix . '(?<!/)profile.php\?mode=([0-9a-zA-Z]*)"|', 
$prefix . '(?<!/)map.php\?highlight=([0-9]*)"|', 
$prefix . '(?<!/)map.php"|', 
$prefix . '(?<!/)faq.php"|', 
$prefix . '(?<!/)search.php"|', 
$prefix . '(?<!/)memberlist.php"|', 
$prefix . '(?<!/)groupcp.php"|', 
$prefix . '(?<!/)report.php"|', 
$prefix . '(?<!/)viewonline.php"|', 
); 
$urlout = array( 
'"index-mark.html"', 
'"index.html"', 
'"category\\1.html"', 
'"forum\\1.html"', 
'"forum\\1-\\2.html"', 
'"forum\\1-\\2-\\3.html"', 
'"forum\\1-mark.html"', 
'"forum\\1.html"', 
'"ftopic\\1.html"', 
'"ptopic\\1.html"', 
'"ntopic\\1.html"', 
'"ftopic\\1.html"', 
'"ftopic\\1.html"', 
'"ftopic\\1-\\2.html"', 
'"ftopic\\1-\\2-\\3-\\4.html"', 
'"ftopic\\1.html"', 
'"ftopic\\1-\\2.html"', 
'"ftopic\\1.html"', 
'"fpost\\1.html#\\2"', 
'"fpost\\1.html#\\2"', 
'"post-newtopic-\\1.html"', 
'"post-reply-\\1.html"', 
'"post-\\1-\\2.html"', 
'"album.html"', 
'"palbum.html"', 
'"palbum\\1.html"', 
'"profile\\1.html"', 
'"search-author-\\1.html"', 
'"search-\\1-\\2.html"', 
'"search-\\1.html"', 
'"privmsg-\\1-\\2.html"', 
'"privmsg-\\1.html"', 
'"register.html"', 
'"profile-\\1.html"', 
'"map-\\1.html"', 
'"map.html"', 
'"faq.html"', 
'"search.html"', 
'"memberlist.html"', 
'"groups.html"', 
'"report.html"', 
'"online.html"', 
); 
 
$s = preg_replace($urlin, $urlout, $s); 
return $s; 
} 
// 
// end Short URL implementation [larsneo] 
das eingebaut.
irgendwie komm ich hier nicht so richtig weiter
cu

Verfasst: 30.01.2005 18:56
von larsneo
vielleicht wird in deiner lokalen installation

Code: Alles auswählen

$base_url = "$proto$server$path/"; 
nicht korrekt gesetzt...
vielleicht setzt du testweise diesen wert einmal hartkodiert auf die entsprechende adresse der installation...