@@ -3,35 +3,39 @@ User-defined Redirects
3
3
4
4
You can set up redirects for a project in your project dashboard's :guilabel: `Redirects ` page.
5
5
6
- Quick Summary
6
+ .. contents :: Table of contents
7
+ :local:
8
+
9
+ Quick summary
7
10
-------------
8
11
9
- * Log into your readthedocs.org account.
10
- * From your dashboard, select the project on which you wish to add redirects.
11
- * From the project's top navigation bar, select the :guilabel: `Admin ` tab.
12
+ * Go to the :guilabel: `Admin ` tab of your project.
12
13
* From the left navigation menu, select :guilabel: `Redirects `.
13
- * In the form box "Redirect Type" select the type of redirect you want. See below for detail.
14
- * Depending on the redirect type you select, enter FROM and/or TO URL as needed.
14
+ * In the form box "Redirect Type" select the type of redirect you want.
15
+ :ref: `See below <user-defined-redirects:redirect types >` for detail.
16
+ * Depending on the redirect type you select, enter ``From URL `` and/or ``To URL `` as needed.
15
17
* When finished, click the :guilabel: `Add ` button.
16
18
17
19
Your redirects will be effective immediately.
18
20
19
- Limitations
20
- ~~~~~~~~~~~
21
-
22
- Redirects are only implemented in case of a *404 File Not Found * error.
23
- If you need to redirect a large number of files that still exist,
24
- please reach out to :doc: `/support `.
21
+ Features
22
+ --------
25
23
26
- Page & Exact Redirects can redirect to URLs outside Read the Docs.
27
- Define the `To URL ` as the absolute URL you want to redirect to.
24
+ - By default, redirects are followed only if the requested page doesn't exist
25
+ (*404 File Not Found * error), if you need to apply a redirect for files that exist,
26
+ mark the :guilabel: `Force redirect ` option.
27
+ **This option is only available on some plan levels **.
28
+ Please ask support if you need it for some reason.
29
+ - :ref: `user-defined-redirects:page redirects ` and :ref: `user-defined-redirects:exact redirects `
30
+ can redirect to URLs outside Read the Docs,
31
+ just include the protocol in ``To URL ``, e.g ``https://example.com ``.
28
32
29
- Redirect Types
33
+ Redirect types
30
34
--------------
31
35
32
36
We offer a few different type of redirects based on what you want to do.
33
37
34
- Prefix Redirects
38
+ Prefix redirects
35
39
~~~~~~~~~~~~~~~~
36
40
37
41
The most useful and requested feature of redirects was when migrating to Read the Docs from an old host.
@@ -63,7 +67,7 @@ Where ``en`` and ``latest`` are the default language and version values for your
63
67
which will prepend ``/$lang/$version/ `` to all incoming URLs.
64
68
65
69
66
- Page Redirects
70
+ Page redirects
67
71
~~~~~~~~~~~~~~
68
72
69
73
A more specific case is when you move a page around in your docs.
@@ -82,14 +86,23 @@ You would set the following configuration::
82
86
Because of this,
83
87
the ``/ `` at the start of the ``From URL `` doesn't include the ``/$lang/$version `` prefix (e.g.
84
88
``/en/latest ``), but just the version-specific part of the URL.
85
- If you want to set directs only for some languages or some versions, you should use
89
+ If you want to set redirects only for some languages or some versions, you should use
86
90
:ref: `user-defined-redirects:exact redirects ` with the fully-specified path.
87
91
88
- Exact Redirects
92
+ Exact redirects
89
93
~~~~~~~~~~~~~~~
90
94
91
95
*Exact Redirects * are for redirecting a single URL,
92
- and take into account the full URL (including language & version).
96
+ taking into account the full URL (including language and version).
97
+
98
+ You can also redirect a subset of URLs by including the ``$rest `` keyword
99
+ at the end of the ``From URL ``.
100
+
101
+ Exact redirects examples
102
+ ^^^^^^^^^^^^^^^^^^^^^^^^
103
+
104
+ Redirecting a single URL
105
+ ````````````````````````
93
106
94
107
Say you're moving ``docs.example.com `` to Read the Docs and want to redirect traffic
95
108
from an old page at ``https://docs.example.com/dev/install.html `` to a new URL
@@ -109,6 +122,9 @@ Your users query would now redirect in the following manner::
109
122
Note that you should insert the desired language for "en" and version for "latest" to
110
123
achieve the desired redirect.
111
124
125
+ Redirecting a whole sub-path to a different one
126
+ ```````````````````````````````````````````````
127
+
112
128
*Exact Redirects * could be also useful to redirect a whole sub-path to a different one by using a special ``$rest `` keyword in the "From URL".
113
129
Let's say that you want to redirect your readers of your version ``2.0 `` of your documentation under ``/en/2.0/ `` because it's deprecated,
114
130
to the newest ``3.0 `` version of it at ``/en/3.0/ ``.
@@ -128,8 +144,22 @@ Similarly, if you maintain several branches of your documentation (e.g. ``3.0``
128
144
``latest ``) and decide to move pages in ``latest `` but not the older branches, you can use
129
145
*Exact Redirects * to do so.
130
146
147
+ Migrating your documentation to another domain
148
+ ``````````````````````````````````````````````
149
+
150
+ You can use an exact redirect to migrate your documentation to another domain,
151
+ for example::
152
+
153
+ Type: Exact Redirect
154
+ From URL: /$rest
155
+ To URL: https://newdocs.example.com/
156
+ Force Redirect: True
157
+
158
+ Then all pages will redirect to the new domain, for example
159
+ ``https://docs.example.com/en/latest/install.html `` will redirect to
160
+ ``https://newdocs.example.com/en/latest/install.html ``.
131
161
132
- Sphinx Redirects
162
+ Sphinx redirects
133
163
~~~~~~~~~~~~~~~~
134
164
135
165
We also support redirects for changing the type of documentation Sphinx is building.
0 commit comments