@@ -188,10 +188,22 @@ all other redirects need to be matched as is.
188
188
189
189
This makes it impossible to match a path with a trailing slash.
190
190
191
- Explicit ``$rest `` placeholder
192
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191
+ Use ``* `` and `` :splat `` for wildcards
192
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193
193
194
- Explicitly place the ``$rest `` placeholder in the target URL,
194
+ Currently we are using ``$rest `` at the end of the ``From URL ``
195
+ to indicate that the rest of the path should be added to the target URL.
196
+
197
+ A similar feature is implemented in other services using ``* `` and ``:splat ``.
198
+
199
+ Instead of using ``$rest `` in the URL for the suffix wildcard, we now will use ``* ``,
200
+ and ``:splat `` as a placeholder in the target URL to be more consistent with other services.
201
+ Existing redirects can be migrated automatically.
202
+
203
+ Explicit ``:splat `` placeholder
204
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205
+
206
+ Explicitly place the ``:splat `` placeholder in the target URL,
195
207
instead of adding it automatically.
196
208
197
209
Some times users want to redirect to a different path,
@@ -200,18 +212,18 @@ prevent the old path from being added in the final path.
200
212
For example ``/new/path/?_= ``.
201
213
202
214
Instead of adding the path automatically,
203
- users have to add the ``$rest `` placeholder in the target URL.
215
+ users have to add the ``:splat `` placeholder in the target URL.
204
216
For example:
205
217
206
218
From:
207
- ``/old/path/$rest ``
219
+ ``/old/path/* ``
208
220
To:
209
- ``/new/path/$rest ``
221
+ ``/new/path/:splat ``
210
222
211
223
From:
212
- ``/old/path/$rest ``
224
+ ``/old/path/* ``
213
225
To:
214
- ``/new/path/?page=$rest &foo=bar ``
226
+ ``/new/path/?page=:splat &foo=bar ``
215
227
216
228
Improving page redirects
217
229
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -237,16 +249,16 @@ Improving page redirects
237
249
This will allow users to migrate a whole directory to a new path
238
250
without having to create an exact redirect for each version.
239
251
240
- Similar to exact redirects, users need to add the ``$rest `` placeholder explicitly.
252
+ Similar to exact redirects, users need to add the ``:splat `` placeholder explicitly.
241
253
This means that that page redirects are the same as exact redirects,
242
254
with the only difference that they apply to all versions.
243
255
244
256
Example:
245
257
246
258
From:
247
- ``/old/path/$rest ``
259
+ ``/old/path/* ``
248
260
To:
249
- ``/new/path/$rest ``
261
+ ``/new/path/:splat ``
250
262
251
263
Improving Sphinx redirects
252
264
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -262,6 +274,8 @@ Proposed names:
262
274
Other ideas to improve redirects
263
275
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
264
276
277
+ The following improvements will not be implemented in the first iteration.
278
+
265
279
- Run forced redirects before built-in redirects.
266
280
We currently run built-in redirects before forced redirects,
267
281
this is a problem when moving a whole project to a new domain.
@@ -293,10 +307,6 @@ Other ideas to improve redirects
293
307
We can consider adding it in the future.
294
308
Maybe we can expose the current language and version as placeholders.
295
309
296
- - Replace ``$rest `` with ``* `` in the from_url.
297
- This will be more consistent with other services,
298
- but it will require users to re-learn the feature.
299
-
300
310
- Per-protocol redirects.
301
311
We should push users to always use HTTPS.
302
312
0 commit comments