[wp-trac] [WordPress Trac] #17048: URLs delivered to the browser should be root-relative
WordPress Trac
wp-trac at lists.automattic.com
Tue Aug 23 18:35:47 UTC 2011
#17048: URLs delivered to the browser should be root-relative
-----------------------------+-----------------------
Reporter: dmole | Owner: edwardw
Type: feature request | Status: reopened
Priority: normal | Milestone:
Component: General | Version: 3.1
Severity: normal | Resolution:
Keywords: close |
-----------------------------+-----------------------
Comment (by dmole):
Replying to [comment:30 dd32]:
example 1:
> {{{
> add_filter('site_url', function($url) {
> if ( true ) {
> $url_parts = parse_url($url);
> $url = $url_parts['path'] . (array_key_exists('query',$url_parts) ?
'?'.$url_parts['query'] : '');
> }
> return $url;
> });
> }}}
This seems to work to slightly better than adwardw's patch, with only a
bit more overhead, when added to wp-content/plugins/hello.php. the
advantage is that it deals with headers properly, the problem is that we
need "true" replaced with something to prevent changing the siteurl
setting in the UI and some way to deal with emails. Any help with this
would be greatly appreciated.
example 2:
> {{{
> define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/');
> define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '/');
> define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-
content');
> }}}
This did not work for me; adding this code to wp-content/plugins/hello.php
makes links from http://127.0.0.1/wordpress/
point to http://random-page/ instead of http://127.0.0.1/wordpress/random-
page/ or /wordpress/random-page/, I tried some variations but could not
find something that worked, so I'll ignore it in favor of the first
example.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17048#comment:32>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list