1 gabbahead Aug 20, 2005 15:56
3 gabbahead Aug 20, 2005 17:03
I'd love to, but my B2 stats and my Webalizer stats don't add up. I suspect B2 is using every image reference as a new visit plus using absolute urls might be pushing up my bandwidth. My blog is consuming a lot of bandwidth and I want to curb this.
4 personman Aug 20, 2005 18:04
I've never heard of every absolute url image being counted as a separate hit or using more bandwidth than a relative url. You might check with your host about that. I use absolute urls, and they don't show up in my b2 stats. Now, when the file isn't there, your .htaccess file might redirect to b2evolution, causing a stat log.
5 kweb Aug 25, 2005 23:45
Absolute URLs will not affect your bandwidth. The browser will request and download the same file (using the same bandwidth) regardless of the type of URL used.
I can't say for sure how the b2evolution stats are compiled, but it doesn't make sense that an absolute URL would make a difference there, either.
6 xangelusx Mar 24, 2006 23:18
What about URLs relative to the site root, as in "/homepage/images/clock.jpg". That is a vild URL, but when I preview a post with an image path like that it gives me an error:
Found invalid URL: Invalid URL
One way around this - in evocore/_misc.funcs.php replace the original validate_url function with this:
{
global $debug, $Debuglog;
if( empty($url) )
{ // Empty URL, no problem
return false;
}
// minimum length: http://az.fr/
if( strlen($url) < 13 )
{ // URL too short!
$Debuglog->add( 'URL «'.$url.';» is too short!', 'error' );
return T_('Invalid URL');
}
$pattern_url = '<^ # start
( # there may not be a scheme if the URL is relative to the site root which is OK
( #
([a-z][a-z0-9+.\-]*) # scheme
:[0-9]* # port optionally
// # allow absolute URLs only
) #
| #
/ # or URLs relative to site root
) #
[a-z0-9][a-z0-9~+.\-_,:;/\\\\*]* # Don t allow anything too funky like entities
([?#][a-z0-9~+.\-_,:;/\\\\%&=?#*\ \[\]]*)? #
$>ix';
if( ! preg_match($pattern_url, $url, $matches) )
{ // Cannot vaidate URL structure
$Debuglog->add( 'URL «'.$url.';» does not match url pattern!', 'error' );
return T_('Invalid URL «'.$url.';» ');
}
$scheme = ( ( isset( $matches[3] ) ) ? strtolower($matches[3]) : '' );
if( !in_array( $scheme, $allowed_uri_scheme ) )
{ // Scheme not allowed
return T_('URI scheme «'.$scheme.';» not allowed');
}
// Search for blocked URLs:
if( $block = antispam_check($url) )
{
if( $debug ) return 'URL «'.$url.';» refused. Debug info: blacklisted word: ['.$block.']';
return T_('URL «'.$url.';» not allowed');
}
return false; // OK
}
Then in conf/_formatting.php add an empty string to the $comments_allowed_uri_scheme array:
$comments_allowed_uri_scheme = array
(
'', # allow URLs relative to site root
'http',
'https',
'ftp',
'gopher',
'nntp',
'news',
'mailto',
'irc',
'aim',
'icq'
);
Non-absolute urls will be relative to the folder for the skin you're using. So you can move your images into www.yoursite.com/blog/skins/yourskin/images, or you can just use absolute urls (recommended).