-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.txt
221 lines (146 loc) · 7.21 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
=== Multisite Blog Alias ===
Contributors: podpirate
Donate link: https://donate.unhcr.org/
Tags: network, redirect, multisite, domain
Requires at least: 4.8
Requires PHP: 5.6
Tested up to: 6.7
Stable tag: 1.2.1
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Set up redirects for Multisite-Blogs.
== Description ==
WP Multisite plugin to maintain URL-redirects for Blogs.
## Features
- Permanent 301 Redirect to blogs main domain
- Painless installation and activation – no file access necessary.
- Checks domain status
- Supports UTF-8 Domains
- [WP-Cli](https://wp-cli.org/) commands
## Usage
1. **Set up your DNS**. Make sure your Domain points to your Wordpress installation. You can achieve this by either setting up an A- or CNAME-Record in your DNS configuration. Your webserver must be configured to handle requests on the given Domain.
2. Under **Network Admin – Sites** edit the site and select the Alias Domains Tab.
3. Enter the domain without `http` ao `/` and click "Add".
4. Click "Check Status" to see if it worked. If something went wrong you will see an error message.
If you want to redirect with URL path appended (e.g. from `some-alias.tld/some/path` to `some-real-blog.tld/some/path`), add this to your `wp-config.php`:
define( 'WPMU_BLOG_ALIAS_REDIRECT_WITH_PATH', true );
#### Status messages
**Warning: The domain matches the site URL of this blog:** The Blog is using the domain name as Site URL.
**Error: The domain is already used by another site:** A different Blog is already using the domain as Site URL. Eiter Remove the alias from the sblog you are currently workin on, or from the other one.
**The domain is unreachable:** There is likely an error in your DNS or your Webserver configuration. Use `nslookup` from he command line or [whatsmydns.net](https://www.whatsmydns.net/) to check the DNS-Settings.
**The domain or a redirect does not point to this blog:** Following all redirects did not end up on your WordPress-Site, but somewhere else. There is likely an error in your DNS or your Webserver configuration.
## WP-CLI Examples
### Listing Domain aliases
**List alias domains for blog-id 123**
wp alias-domains list --blog_id=123
**Output minified json of all aliases**
wp alias-domains list --format=json --compact=2
**Output csv including the header row but omitting other messages into file**
wp alias-domains list --format=csv --compact > alias-list.csv
### Add Domain Alias
wp alias-domains add --blog_id=123 --domain_alias=quux.foobar.tld
### Remove Domain Alias
**Remove a specific alias**
wp alias-domains remove --domain_alias=quux.foobar.tld
**Remove all aliases for blog 123**
wp alias-domains remove --blog_id=123
### Testing Domain Aliases
wp alias-domains test --domain_alias=quux.foobar.tld
## Plugin PHP-API
The plugin introduces two functions allowing you to add / remove a domain aliases from inside PHP.
**Add Domain alias**
$result = alias_domain_add( $blog_id, 'quux.foobar.tld' );
if ( is_wp_error( $result ) ) {
// handle error
}
**Remove specific Domain alias**
$result = alias_domain_remove_by( 'domain_alias', 'quux.foobar.tld' );
if ( is_wp_error( $result ) ) {
// handle error
}
**Remove Domain aliases for a specific blog**
$result = alias_domain_remove_by( 'blog_id', 123 );
if ( is_wp_error( $result ) ) {
// handle error
}
## Development
Please head over to the source code [on Github](https://github.com/mcguffin/multisite-blog-alias).
== Installation ==
Follow the standard [WordPress plugin installation procedere](http://codex.wordpress.org/Managing_Plugins).
The installer will:
1. Create a database table `{$table_prefix}alias_domains`
2. Create a file `wp-content/sunrise.php` or append its PHP to it, if the file already exists.
3. Insert `define( 'SUNRISE', true );` in your wp-config.
== Frequently asked questions ==
= I found a bug. Where should I post it? =
Please use the issues section in the [GitHub-Repository](https://github.com/mcguffin/multisite-blog-alias/issues).
I will most likely not maintain the forum support forum on wordpress.org. Anyway, other users might have an answer for you, so it's worth a shot.
= I'd like to suggest a feature. Where should I post it? =
Please post an issue in the [GitHub-Repository](https://github.com/mcguffin/multisite-blog-alias/issues)
= Will you anwser support requests by email? =
No.
= The plugin works pretty well for me. Any way I can show my appreciation? =
Thanks! As a well trained person living in a rich country there is little more I need.
The majority on the other hand is not doing very well. And because this plugin is about redirection, I'd like to point your attention to the several refugee crises taking place everwhere around the world.
If my little piece of software was able to help you, please consider helping others and place a donation at the [UNHCR](https://donate.unhcr.org/).
== Screenshots ==
1. Network admin - Edit site. I completely messed up a few webservers to run the last test in the list!
== Upgrade Notice ==
On the whole upgrading is always a good idea.
== Changelog ==
= 1.2.1 =
- New Option: Redirect /wp-admin/ and /wp-login.php
= 1.2.0 =
- Status Check: Test SSL status and show redirects
- Introduce PHP functions `alias_domain_add()` and `alias_domain_remove_by()`
- CLI: Introduce site_id parameter
- Refactor: Error messages
= 1.1.9 =
- Fix: PHP 8.2 deprecation notices
- Fix: Missing network admin page title
= 1.1.8 =
- Enhancement: Handle `ms_network_not_found`
= 1.1.7 =
- Fixed main blog redirection
- Test with PHP 8
- Test with WP 5.8
= 1.1.6 =
- Feature: auto-remove blog aliases when a blog is being deleted
- Fix: domain check returned false negative if network admin is under ssl and blog URL is not
- Fix: Model class didn't return insert id. As a result action `blog_alias_created` was called with a wrong argument
= 1.1.5 =
- Plugin-API: introduce filter `blog_alias_create_data` and actions `blog_alias_created`, `blog_alias_delete`, `blog_alias_deleted`, `blog_alias_delete_multiple` and `blog_alias_deleted_multiple`
- Fix: redirect after activation in WP-Cli environment
- Fix: php warning __wakeup magic method
- Fix: Sunrise and wp-config.php not changed after activation
= 1.1.4 =
- Security hardening
- Tested up to WordPress 5.6
= 1.1.3 =
- Fix: Wrong table updated after upgrade
= 1.1.2 =
- Fix: Not installing on Mysql <=5.6 / InnoDB
- Fix: Support domain names with up to 253 characters
= 1.1.1 =
- Fix: Fatal error on entwork activation
= 1.1.0 =
- More input validation
- Drop support for PHP 5.5
- Code Refactoring
- Fix: Domain name not visible when alias was created with wp-cli
= 1.0.4 =
- Security hardening
= 1.0.3 =
- Add Option "Redirect with Path" to network settings page
- Introduce wp-cli --field parameter
= 1.0.2 =
- Add support for utf8 domain names
- Fix PHP strict warning
= 1.0.1 =
- Send `X-Redirect-By` HTTP Header
- Option to redirect with path using constant `WPMU_BLOG_ALIAS_REDIRECT_WITH_PATH`.
- Fix: PHP Fatal in sunrise.php if formatting functions are not present
- Fix: Make sure Status check ah´jax is loaded from Network-URL
- Validation: Make sure only hostnames can be entered
= 1.0.0 =
- Initial release