A WordPress plugin that converts all URL formats to root-relative URLs to enable seamless transitioning between staging/production host environments and debugging/testing from mobile devices, without the use of hackish tactics like textual find-replace strategies or risky hosts/NAT spoofing strategies.
With Root Relative URLs you can browse your development site from http://localhost/ or http://127.0.0.1/ or from a named network resource like http://mycomputername/ without worrying about links redirecting you back to your site’s URL.
This plugin also modifies the tinyMCE hooks so links and media embedded with built-in tools will only insert URLs from the first forward slash after the domain (i.e. the root of your site.) This means when you push content changes to a staging or production environment they are guaranteed to reference the correct target instead of accidentally referencing a production resource in development or, worse-yet, a development-exclusive resource in production.
It supports path-based MU Installations, but does not support domain-based MU sites due to architectural deficiencies in the WordPress core.
Version 1.5 fixes an infinite redirect problem that is a result of a core bug in WordPress. If you have problems with the <!–more–> tag or permalinks for custom post types, please read the FAQ or new Install Steps for support.
Version 2.2 allows for adding certain URL’s or partial URL’s to a blacklist, meaning I won’t use root relative urls, but dynamic absolute URLs instead for displaying content. This will fix problems with 3rd party plugins, and can be configured on the General Settings page.
You’re done! Now you can happily browse and manage your site from any URL, including an IP address if you wish.
There was a long outstanding support issue regarding these problems that I think is resolved from my plugin perspective.
The core issue (https://core.trac.wordpress.org/ticket/21824) is still not fixed, and the temporary workaround for that problem is to go into Admin > Settings > Permalinks, and click “Save Changes” twice in a row, letting the page reload between each save.
This should fix the rewrite rules used internally to WordPress to route URLs to custom post content, more links.
What is a Root-Relative URL?
Traditional relative URLs are bad because any change to your directory structure can change where the content is relative to.
But Root-Relative URLs are good because you’ll always know where they start, and search engines support their usage so you’ll have no problems with SEO.
In fact, over 93% of the top 100 websites (according to Alexa) use root relative urls. Including Wordpres.org, WordPress.com, Facebook.com, Twitter.com, Google.com, Wikipedia.org, Yahoo.com, Youtube.com, Amazon.com, Fickr.com etc.
Most RSS Feed readers handle them appropriately (notable exceptions include FeedBurner and FeedBlitz) but my plugin takes into account their lack of HTML specification adherence.
Why doesn’t WordPress use root-relative URLs to begin with?
server first, thoroughly tested, and then migrated to production as a best practice.
server. You could do this with absolute URLs as well, but that adds an extra step of doing a search / replace of all http://staging.com/ links to http://production.com/.
router configurations that many people don’t have at their disposal on typical WIFI networks.
Will this plugin correct URLs that are already embedded in my site’s content?
but it will not alter links you have already embedded.
Should I use this plugin if I only have one production site and I make all of my changes in production?
developed content that works with root-relative links.
Will this plugin work with MU sites (Multi-user installations)?
Until then this plugin will not work out of the box for MU installs. I have discovered an approach for resolving this problem without a core hack but I will need to research it before implementing the update. It will be a big ol nasty hack but it will work.
You shouldn't use this plugin, it will break everything. Enjoy the hell.
This is just not a good idea for the long term health of a site's database. There's a number of great database migration tools – including hosting tools – that should be used when transitioning a site from a staging address to a live address that don't break a whole bunch of other plugin functionality by messing with how get_permalink() works.
Not compatible with Store Locator Plus. Causes the plug-in to fail.
Google Analytics Dashboard for WP does not work (it's pane is empty in the Dashboard) when Root Relative URls is enabled.
Amazon has been installing this on its cloud sites by default. It will break your Yoast SEO plugin sitemaps though. If you are getting 404's on your page and post sitemaps and have this plugin try deactivating it.
“Root Relative URLs” is open source software. The following people have contributed to this plugin.
Translate “Root Relative URLs” into your language.
Bug fix: really fixed path undefined notice for urls 🙁 why @ symbol didn’t work is beyond me. I couldn’t reproduce the issue, but this was faster than debugging it.
Enhancement: Added support for wp-include and WPML Multilingual CMS plugin. Thanks to @tfmtfm for the patch.
Correction: Fixed changelog notes for version 1.8.
Bug fix: Added more hooks to fix other urls. Thanks to @lcyconsulting for the solution.
Bug fix: This patch fixes add media support. Thanks to @najamelan for the suggested solution.
Bug fix: Added fix for users who have customized File Upload paths, image attachments now use root relative urls.
Bug fix: I really wish php < 5.3 would die – fixed incompatible funciton reference.
Bug fix: Discovered url fragment identifiers were being dropped entirely from urls, which broke a couple ajax behaviors – most noticeably the menu editor.
Investigated issue with wp-cron… discovered it was an issue with a different plugin altogether, testing showed no problems with root relative urls.
Updated plugin to massage rss content urls back to absolute site urls. This shouldn’t need to even happen but unfortunately feedburner and feedblitz don’t follow the html spec 🙁 Google Reader and a bunch of others do however, so there is hope of fixing this problem on feedburner & feedblitz’s end.
Despite this ticket being not yet patched: https://core.trac.wordpress.org/ticket/19210 I have fixed the previous bugs related to comments_link_feed() or comment_link() functions.