[wp-trac] [WordPress Trac] #17048: URLs delivered to the browser should be root-relative

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 11 11:06:08 UTC 2011


#17048: URLs delivered to the browser should be root-relative
--------------------------+-------------------------
 Reporter:  dmole         |       Owner:  edwardw
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  3.1
 Severity:  normal        |  Resolution:  maybelater
 Keywords:  dev-feedback  |
--------------------------+-------------------------

Comment (by edwardw):

 Replying to [comment:12 dmole]:
 > Replying to [comment:11 dmole]:
 > Realizing ob_start is a PHP function that rewrites the whole page, that
 is not a usable solution for anyone who wants external links. (unless they
 use a preset list of known domains in the callback function)
 > {{{
 >  /** Hack to make URLs root relative */
 >  ob_start( 'make_url_root_relative' );
 >  function make_url_root_relative( $string ) {
 >       return  preg_replace(
 '/https?...(myblog.com|127.0.0.1|nat.whatever.tld)\//i', '/', $string );
 >  }
 > }}}
 > I'm guessing the function should check if it's output is an email,
 ideas?

 What's wrong with replacing with whatever domain the user is on
 ({{{$_SERVER['HTTP_HOST']}}})?  With this method, you don't need to
 maintain a list of known network interfaces, since if the browser can
 access it, it must be accessible onthat interface.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17048#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list