前言介紹
- 這款 WordPress 外掛「Safe Redirect Manager」是 2012-08-26 上架。
- 目前有 50000 個安裝啟用數。
- 上一次更新是 2025-04-23,距離現在已有 11 天。
- 外掛最低要求 WordPress 6.5 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
- 有 78 人給過評分。
- 論壇上目前有 1 個提問,問題解答率 0%
外掛協作開發者
10up | jeffpaul | taylorde | tlovett1 | tollmanz | jakemgold | danielbachhuber |
外掛標籤
http redirects | URL Redirection | redirect manager | multisite redirects | safe http redirection |
內容簡介
透過 WordPress 的方式輕鬆、安全地管理您網站的重導向。目前市面上有許多重導向外掛,其中大部分的外掛將重導向存儲到選項表或自訂表中。大部分的外掛提供大量不必要的選項。有些外掛會對效能產生嚴重的影響(例如 404 錯誤日誌)。Safe Redirect Manager 使用自訂文章類別來存儲重導向。這使您的資料具有可攜性,也使您的網站具有可擴展性。Safe Redirect Manager 的設計是為了處理企業級的流量,並在許多重要的出版網站上被使用。此外,此外掛遵循 WordPress 原則:選擇,而非選項,僅提供所需的功能。此外,外掛附帶了可讓插件具有極高擴展性的動作和篩選器。
在 GitHub 上複製此外掛。
設定
此外掛並不存在任何高級設定。要管理重導向,請前往管理面板(“工具” > “Safe Redirect Manager”)。
每個重導向都包含幾個可以利用的欄位:
“重導向來源”
這應該是相對於 WordPress 安裝根目錄的路徑。當有人訪問您網站與此路徑匹配的網頁時,將會進行重導向。例如,如果您的網站位於 http://example.com/wp/,並且您想要將 http://example.com/wp/about 重導向至http://example.com,則“重導向來源”就會是 /about。
如果單擊“啟用正則表達式”核取方塊,則可在路徑中使用正則表達式。有許多優秀的教學有關正則表達式的知識。
您也可以在您的“重導向來源”路徑中使用萬用字元。透過在 URL 的結尾加入一個 *,您的重導向將匹配任何以“重導向來源”開始的請求。萬用字元支援替換。這意味著如果您在來源路徑中使用了萬用字元來匹配一個字符串,那麼此字符串可以替換重導向 To 路徑中的萬用字符。例如,如果您的“重導向來源”是/test/*,“重導向至”是 http://google.com/*,且所請求的路徑是 /test/string,則使用者會被重導向至 http://google.com/string。
“重導向至”
這應該是一個路徑(即/test)或網址(即http://example.com/wp/test)。如果有人請求的路徑與“重導向來源”匹配,則他們會被重導向至這裡。“重導向至”支持萬用字元和正則表達式替換。
“HTTP 狀態碼”
HTTP 狀態碼通常是整數,代表有關請求的資訊(例如請求是否成功、未經授權、未找到等)。您幾乎總是應該使用 302(暫時移動)或 301(永久移動)。
注意:
重導向是使用 Transients API 進行快取的。當添加、更新和刪除重導向時,會進行快取清除,因此您不應該服務過期的重導向。
預設情況下,此外掛最多允許有 1000 個重導向以避免影響效能。有一個名為 srm_max_redirects 的篩選器可用於增加此數字。
默認情況下,“重導向來源”和所請求的路徑是不區分大小寫的。
開發人員可以使用 srm_additional_status_codes 篩選器來添加所需的狀態碼。
原文外掛簡介
Safely manage your site’s redirects the WordPress way. There are many redirect plugins available. Most of them store redirects in the options table or in custom tables. Most of them provide tons of unnecessary options. Some of them have serious performance implications (404 error logging). Safe Redirect Manager stores redirects as Custom Post Types. This makes your data portable and your website scalable. Safe Redirect Manager is built to handle enterprise level traffic and is used on major publishing websites. The plugin comes with only what you need following the WordPress mantra, decisions not options. Actions and filters make the plugin very extensible.
Fork the plugin on GitHub.
Configuration
There are no overarching settings for this plugin. To manage redirects, navigate to the administration panel (“Tools” > “Safe Redirect Manager”).
Each redirect contains a few fields that you can utilize:
“Redirect From”
This should be a path relative to the root of your WordPress installation. When someone visits your site with a path that matches this one, a redirect will occur. If your site is located at http://example.com/wp/ and you wanted to redirect http://example.com/wp/about to http://example.com, your “Redirect From” would be /about.
Clicking the “Enable Regex” checkbox allows you to use regular expressions in your path. There are many great tutorials on regular expressions.
You can also use wildcards in your “Redirect From” paths. By adding an * at the end of a URL, your redirect will match any request that starts with your “Redirect From”. Wildcards support replacements. This means if you have a wildcard in your from path that matches a string, you can have that string replace a wildcard character in your “Redirect To” path. For example, if your “Redirect From” is /test/*, your “Redirect To” is http://google.com/*, and the requested path is /test/string, the user would be redirect to http://google.com/string.
“Redirect To”
This should be a path (i.e. /test) or a URL (i.e. http://example.com/wp/test). If a requested path matches “Redirect From”, they will be redirected here. “Redirect To” supports wildcard and regular expression replacements.
“HTTP Status Code”
HTTP status codes are numbers that contain information about a request (i.e. whether it was successful, unauthorized, not found, etc). You should almost always use either 302 (temporarily moved) or 301 (permanently moved).
Note:
Redirects are cached using the Transients API. Cache busts occur when redirects are added, updated, and deleted so you shouldn’t be serving stale redirects.
By default the plugin only allows at most 1000 redirects to prevent performance issues. There is a filter srm_max_redirects that you can utilize to up this number.
“Redirect From” and requested paths are case insensitive by default.
Developers can use srm_additional_status_codes filter to add status codes if needed.
Rules set with 403 and 410 status codes are handled by applying the HTTP status code and render the default WordPress wp_die screen with an optional message.
Rules set with a 404 status code will apply the status code and render the 404 template.
Browsers heavily cache 301 (permanently moved) redirects. It’s recommended to test your permanent redirects using the 302 (temporarily moved) status code before changing them to 301 permanently moved.
Developer Documentation
Safe Redirect Manager includes a number of actions and filters developers can make use of. These are documented on the Safe Redirect Manager developer documentation micro-site.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Safe Redirect Manager」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0 | 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8 | 1.9 | 1.4.1 | 1.4.2 | 1.7.1 | 1.7.2 | 1.7.3 | 1.7.4 | 1.7.5 | 1.7.6 | 1.7.7 | 1.7.8 | 1.7.9 | 1.9.1 | 1.9.2 | 1.9.3 | 2.0.0 | 2.0.1 | 2.1.0 | 2.1.1 | 2.1.2 | 2.2.0 | 2.2.1 | 2.2.2 | trunk | 1.10.0 | 1.10.1 | 1.11.0 | 1.11.1 |
延伸相關外掛(你可能也想知道)
暫無相關外掛推薦。