Title: Absolute-to-Relative URLs
Author: Steven Vachon
Published: <strong>2011年3月23日</strong>
Last modified: 2013年3月28日

---

プラグインを検索

このプラグインは **WordPress の最新3回のメジャーリリースに対してテストされていま
せん**。もうメンテナンスやサポートがされていないかもしれず、最新バージョンの WordPress
で使用した場合は互換性の問題が発生する可能性があります。

![](https://s.w.org/plugins/geopattern-icon/absolute-to-relative-urls.svg)

# Absolute-to-Relative URLs

 作者: [Steven Vachon](https://profiles.wordpress.org/prometh/)

[ダウンロード](https://downloads.wordpress.org/plugin/absolute-to-relative-urls.zip)

 * [詳細](https://ja.wordpress.org/plugins/absolute-to-relative-urls/#description)
 * [レビュー](https://ja.wordpress.org/plugins/absolute-to-relative-urls/#reviews)
 *  [インストール](https://ja.wordpress.org/plugins/absolute-to-relative-urls/#installation)
 * [開発](https://ja.wordpress.org/plugins/absolute-to-relative-urls/#developers)

 [サポート](https://wordpress.org/support/plugin/absolute-to-relative-urls/)

## 説明

If you were to use this on a website like _http;//example.com/test/testing/_, you
would get results like these:

 1.  * **Before:** http;//example.com/test/another-test/#anchor
     * **After:** ../another-test/#anchor
 2.  * **Before:** http;//example.com/wp-content/themes/twentyten/style.css
     * **After:** /wp-content/themes/twentyten/style.css
 3.  * **Before:** http_s_;//example.com/wp-content/themes/twentyten/style.css
     * **After:** http_s_;//example.com/wp-content/themes/twentyten/style.css
 4.  * **Before:** http;//google.com/test/
     * **After:** //google.com/test/
 5.  * **Before:** ../../../../../../../../#anchor
     * **After:** /#anchor
     * **After** (`$output_type=1`)**:** ../../#anchor

**All string parsing. _No_ directory browsing.**

If you’re looking for a plugin that will _automatically_ convert all URLs on your
WordPress site, instead check out my other plugin, **[WP-HTML-Compression](https://wordpress.org/extend/plugins/wp-html-compression/)**.
**
Before you copy this code and add it into your own**, keep in mind that there will
probably be future updates. Keeping the code within an installed plugin will make
sure that you’re notified.

## インストール

 1. Download the plugin (zip file).
 2. Upload and activate the plugin through the “Plugins” menu in the WordPress admin.

## FAQ

  Why isn’t this automatic?

Check out **[WP-HTML-Compression](https://wordpress.org/extend/plugins/wp-html-compression/)**
instead.

  How does this work?

Just use `absolute_to_relative_url($url)`.

  Will this plugin work for WordPress version x.x.x?

This plugin has only been tested with versions of WordPress as early as 3.2. For
anything older, you’ll have to see for yourself.

## 評価

このプラグインにはレビューがありません。

## 貢献者と開発者

Absolute-to-Relative URLs はオープンソースソフトウェアです。以下の人々がこのプラグ
インに貢献しています。

貢献者

 *   [ Steven Vachon ](https://profiles.wordpress.org/prometh/)

[“Absolute-to-Relative URLs” をあなたの言語に翻訳しましょう。](https://translate.wordpress.org/projects/wp-plugins/absolute-to-relative-urls)

### 開発に興味がありますか ?

[コードを閲覧](https://plugins.trac.wordpress.org/browser/absolute-to-relative-urls/)
するか、[SVN リポジトリ](https://plugins.svn.wordpress.org/absolute-to-relative-urls/)
をチェックするか、[開発ログ](https://plugins.trac.wordpress.org/log/absolute-to-relative-urls/)
を [RSS](https://plugins.trac.wordpress.org/log/absolute-to-relative-urls/?limit=100&mode=stop_on_copy&format=rss)
で購読してみてください。

## 変更履歴

#### 0.3.4

 * Empty, hash-only anchors (`"#"`) are no longer invalidated to `"/"`

#### 0.3.3

 * JavaScript URIs (`"javascript:"`) are no longer invalidated as paths

#### 0.3.2

 * Data URIs (`"data:"`) are no longer invalidated as paths

#### 0.3.1

 * Domains with and without “www.” are no longer considered to be identical by default,
   but can still be overridden

#### 0.3

 * Scheme-relative URLs (`//domain.com`) now supported on input and output
 * Cleans up the ports and paths of external URLs
 * Optionally, output only host-relative URLs (`/root-dir/`)
 * Speed optimizations
 * Minor bug fixes

#### 0.2

 * Path-relatve URLs (`../`), or parenting, now supported on input and output
 * Differentiates schemes/protocols, usernames, passwords, hosts, ports, paths, 
   resources/files, queries and fragments/hashes
 * Considers domains with and without “www.” to be identical, and can be overridden
 * Outputs the shortest url (host- or path-relative) by default, and can be overridden
 * Custom site URL support, but only with a separate `new Absolute_to_Relative_URLs()`
   instance

#### 0.1

 * Initial release

## メタ

 *  バージョン **0.3.4**
 *  最終更新日 **14年前**
 *  有効インストール数 **10+**
 *  WordPress バージョン ** 3.2またはそれ以降 **
 *  検証済み最新バージョン: **3.4.2**
 *  言語
 * [English (US)](https://wordpress.org/plugins/absolute-to-relative-urls/)
 * タグ
 * [absolute](https://ja.wordpress.org/plugins/tags/absolute/)[function](https://ja.wordpress.org/plugins/tags/function/)
   [link](https://ja.wordpress.org/plugins/tags/link/)[links](https://ja.wordpress.org/plugins/tags/links/)
 *  [詳細を表示](https://ja.wordpress.org/plugins/absolute-to-relative-urls/advanced/)

## 評価

 5つ星中5つ星

 *  [  2 5-星レビュー     ](https://wordpress.org/support/plugin/absolute-to-relative-urls/reviews/?filter=5)
 *  [  0 4-星レビュー     ](https://wordpress.org/support/plugin/absolute-to-relative-urls/reviews/?filter=4)
 *  [  0 3-星レビュー     ](https://wordpress.org/support/plugin/absolute-to-relative-urls/reviews/?filter=3)
 *  [  0 2-星レビュー     ](https://wordpress.org/support/plugin/absolute-to-relative-urls/reviews/?filter=2)
 *  [  0 1-星レビュー     ](https://wordpress.org/support/plugin/absolute-to-relative-urls/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/absolute-to-relative-urls/reviews/#new-post)

[すべてのレビューを見る](https://wordpress.org/support/plugin/absolute-to-relative-urls/reviews/)

## 貢献者

 *   [ Steven Vachon ](https://profiles.wordpress.org/prometh/)

## サポート

意見や質問がありますか ?

 [サポートフォーラムを表示](https://wordpress.org/support/plugin/absolute-to-relative-urls/)