Closes #25910: fix dead and permanently redirected links in the docs. Thanks to SilentGhost for the patch.
diff --git a/Doc/howto/curses.rst b/Doc/howto/curses.rst
index 87a5cab..188a5cf 100644
--- a/Doc/howto/curses.rst
+++ b/Doc/howto/curses.rst
@@ -545,7 +545,7 @@
   a lengthy tutorial for C programmers.
 * `The ncurses man page <http://linux.die.net/man/3/ncurses>`_
 * `The ncurses FAQ <http://invisible-island.net/ncurses/ncurses.faq.html>`_
-* `"Use curses... don't swear" <http://www.youtube.com/watch?v=eN1eZtjLEnU>`_:
+* `"Use curses... don't swear" <https://www.youtube.com/watch?v=eN1eZtjLEnU>`_:
   video of a PyCon 2013 talk on controlling terminals using curses or Urwid.
 * `"Console Applications with Urwid" <http://www.pyvideo.org/video/1568/console-applications-with-urwid>`_:
   video of a PyCon CA 2012 talk demonstrating some applications written using
diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst
index 945a240..6330be5 100644
--- a/Doc/howto/functional.rst
+++ b/Doc/howto/functional.rst
@@ -332,7 +332,7 @@
 
 List comprehensions and generator expressions (short form: "listcomps" and
 "genexps") are a concise notation for such operations, borrowed from the
-functional programming language Haskell (http://www.haskell.org/).  You can strip
+functional programming language Haskell (https://www.haskell.org/).  You can strip
 all the whitespace from a stream of strings with the following code::
 
     line_list = ['  line 1\n', 'line 2  \n', ...]
@@ -716,7 +716,7 @@
 It doesn't construct an in-memory list and exhaust all the input iterators
 before returning; instead tuples are constructed and returned only if they're
 requested.  (The technical term for this behaviour is `lazy evaluation
-<http://en.wikipedia.org/wiki/Lazy_evaluation>`__.)
+<https://en.wikipedia.org/wiki/Lazy_evaluation>`__.)
 
 This iterator is intended to be used with iterables that are all of the same
 length.  If the iterables are of different lengths, the resulting stream will be
@@ -1199,7 +1199,7 @@
 
 **Structure and Interpretation of Computer Programs**, by Harold Abelson and
 Gerald Jay Sussman with Julie Sussman.  Full text at
-http://mitpress.mit.edu/sicp/.  In this classic textbook of computer science,
+https://mitpress.mit.edu/sicp/.  In this classic textbook of computer science,
 chapters 2 and 3 discuss the use of sequences and streams to organize the data
 flow inside a program.  The book uses Scheme for its examples, but many of the
 design approaches described in these chapters are applicable to functional-style
@@ -1208,12 +1208,12 @@
 http://www.defmacro.org/ramblings/fp.html: A general introduction to functional
 programming that uses Java examples and has a lengthy historical introduction.
 
-http://en.wikipedia.org/wiki/Functional_programming: General Wikipedia entry
+https://en.wikipedia.org/wiki/Functional_programming: General Wikipedia entry
 describing functional programming.
 
-http://en.wikipedia.org/wiki/Coroutine: Entry for coroutines.
+https://en.wikipedia.org/wiki/Coroutine: Entry for coroutines.
 
-http://en.wikipedia.org/wiki/Currying: Entry for the concept of currying.
+https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying.
 
 Python-specific
 ---------------
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
index 44718d5..582a034 100644
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -1316,7 +1316,7 @@
 -----------------------------------------
 
 Below is an example of a logging configuration dictionary - it's taken from
-the `documentation on the Django project <https://docs.djangoproject.com/en/1.3/topics/logging/#configuring-logging>`_.
+the `documentation on the Django project <https://docs.djangoproject.com/en/1.4/topics/logging/#configuring-logging>`_.
 This dictionary is passed to :func:`~config.dictConfig` to put the configuration into effect::
 
     LOGGING = {
diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst
index 4ce14f9..d66770f 100644
--- a/Doc/howto/logging.rst
+++ b/Doc/howto/logging.rst
@@ -310,7 +310,7 @@
 If your logging needs are simple, then use the above examples to incorporate
 logging into your own scripts, and if you run into problems or don't
 understand something, please post a question on the comp.lang.python Usenet
-group (available at http://groups.google.com/group/comp.lang.python) and you
+group (available at https://groups.google.com/group/comp.lang.python) and you
 should receive help before too long.
 
 Still here? You can carry on reading the next few sections, which provide a
diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst
index f2e64ee..10cb94c 100644
--- a/Doc/howto/sorting.rst
+++ b/Doc/howto/sorting.rst
@@ -127,7 +127,7 @@
 ================================
 
 Sorts are guaranteed to be `stable
-<http://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`_\. That means that
+<https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`_\. That means that
 when multiple records have the same key, their original order is preserved.
 
     >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]
@@ -145,7 +145,7 @@
     >>> sorted(s, key=attrgetter('grade'), reverse=True)       # now sort on primary key, descending
     [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]
 
-The `Timsort <http://en.wikipedia.org/wiki/Timsort>`_ algorithm used in Python
+The `Timsort <https://en.wikipedia.org/wiki/Timsort>`_ algorithm used in Python
 does multiple sorts efficiently because it can take advantage of any ordering
 already present in a dataset.
 
@@ -184,7 +184,7 @@
   directly.
 
 Another name for this idiom is
-`Schwartzian transform <http://en.wikipedia.org/wiki/Schwartzian_transform>`_\,
+`Schwartzian transform <https://en.wikipedia.org/wiki/Schwartzian_transform>`_\,
 after Randal L. Schwartz, who popularized it among Perl programmers.
 
 Now that Python sorting provides key-functions, this technique is not often needed.
diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst
index c16cac5..8776e3c 100644
--- a/Doc/howto/unicode.rst
+++ b/Doc/howto/unicode.rst
@@ -73,7 +73,7 @@
 precise historical details aren't necessary for understanding how to
 use Unicode effectively, but if you're curious, consult the Unicode
 consortium site listed in the References or
-the `Wikipedia entry for Unicode <http://en.wikipedia.org/wiki/Unicode#History>`_
+the `Wikipedia entry for Unicode <https://en.wikipedia.org/wiki/Unicode#History>`_
 for more information.)
 
 
@@ -223,8 +223,8 @@
 reading this alternate article before continuing.
 
 Wikipedia entries are often helpful; see the entries for "`character encoding
-<http://en.wikipedia.org/wiki/Character_encoding>`_" and `UTF-8
-<http://en.wikipedia.org/wiki/UTF-8>`_, for example.
+<https://en.wikipedia.org/wiki/Character_encoding>`_" and `UTF-8
+<https://en.wikipedia.org/wiki/UTF-8>`_, for example.
 
 
 Python's Unicode Support
diff --git a/Doc/howto/webservers.rst b/Doc/howto/webservers.rst
index 9e9b69d..3dd4206 100644
--- a/Doc/howto/webservers.rst
+++ b/Doc/howto/webservers.rst
@@ -267,7 +267,7 @@
 Each web server requires a specific module.
 
 * Apache has both `mod_fastcgi <http://www.fastcgi.com/drupal/>`_ and `mod_fcgid
-  <http://httpd.apache.org/mod_fcgid/>`_.  ``mod_fastcgi`` is the original one, but it
+  <https://httpd.apache.org/mod_fcgid/>`_.  ``mod_fastcgi`` is the original one, but it
   has some licensing issues, which is why it is sometimes considered non-free.
   ``mod_fcgid`` is a smaller, compatible alternative.  One of these modules needs
   to be loaded by Apache.
@@ -277,7 +277,7 @@
   `SCGI module <http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModSCGI>`_.
 
 * `nginx <http://nginx.org/>`_ also supports `FastCGI
-  <http://wiki.nginx.org/NginxSimplePythonFCGI>`_.
+  <https://www.nginx.com/resources/wiki/start/topics/examples/simplepythonfcgi/>`_.
 
 Once you have installed and configured the module, you can test it with the
 following WSGI-application::
@@ -307,8 +307,8 @@
 
 .. seealso::
 
-   There is some documentation on `setting up Django with FastCGI
-   <https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/>`_, most of
+   There is some documentation on `setting up Django with WSGI
+   <https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/>`_, most of
    which can be reused for other WSGI-compliant frameworks and libraries.
    Only the ``manage.py`` part has to be changed, the example used here can be
    used instead.  Django does more or less the exact same thing.
@@ -358,7 +358,7 @@
 
 A really great WSGI feature is middleware.  Middleware is a layer around your
 program which can add various functionality to it.  There is quite a bit of
-`middleware <http://www.wsgi.org/en/latest/libraries.html>`_ already
+`middleware <https://wsgi.readthedocs.org/en/latest/libraries.html>`_ already
 available.  For example, instead of writing your own session management (HTTP
 is a stateless protocol, so to associate multiple HTTP requests with a single
 user your application must create and manage such state via a session), you can
@@ -379,7 +379,7 @@
 The code that is used to connect to various low level gateways like CGI or
 mod_python is called a *WSGI server*.  One of these servers is ``flup``, which
 supports FastCGI and SCGI, as well as `AJP
-<http://en.wikipedia.org/wiki/Apache_JServ_Protocol>`_.  Some of these servers
+<https://en.wikipedia.org/wiki/Apache_JServ_Protocol>`_.  Some of these servers
 are written in Python, as ``flup`` is, but there also exist others which are
 written in C and can be used as drop-in replacements.
 
@@ -390,8 +390,8 @@
 .. seealso::
 
    A good overview of WSGI-related code can be found in the `WSGI homepage
-   <http://www.wsgi.org/en/latest/index.html>`_, which contains an extensive list of `WSGI servers
-   <http://www.wsgi.org/en/latest/servers.html>`_ which can be used by *any* application
+   <https://wsgi.readthedocs.org/>`_, which contains an extensive list of `WSGI servers
+   <https://wsgi.readthedocs.org/en/latest/servers.html>`_ which can be used by *any* application
    supporting WSGI.
 
    You might be interested in some WSGI-supporting modules already contained in
@@ -408,7 +408,7 @@
 Python without using WSGI.
 
 One of the most widely used wiki software packages is `MoinMoin
-<http://moinmo.in/>`_.  It was created in 2000, so it predates WSGI by about
+<https://moinmo.in/>`_.  It was created in 2000, so it predates WSGI by about
 three years.  Older versions needed separate code to run on CGI, mod_python,
 FastCGI and standalone.
 
@@ -460,7 +460,7 @@
 .. seealso::
 
    The English Wikipedia has an article about the `Model-View-Controller pattern
-   <http://en.wikipedia.org/wiki/Model-view-controller>`_.  It includes a long
+   <https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller>`_.  It includes a long
    list of web frameworks for various programming languages.
 
 
@@ -543,10 +543,10 @@
 smaller sites SQLite is just enough.
 
 Relational databases are *queried* using a language called `SQL
-<http://en.wikipedia.org/wiki/SQL>`_.  Python programmers in general do not
+<https://en.wikipedia.org/wiki/SQL>`_.  Python programmers in general do not
 like SQL too much, as they prefer to work with objects.  It is possible to save
 Python objects into a database using a technology called `ORM
-<http://en.wikipedia.org/wiki/Object-relational_mapping>`_ (Object Relational
+<https://en.wikipedia.org/wiki/Object-relational_mapping>`_ (Object Relational
 Mapping).  ORM translates all object-oriented access into SQL code under the
 hood, so the developer does not need to think about it.  Most `frameworks`_ use
 ORMs, and it works quite well.
@@ -579,13 +579,13 @@
      helps with choosing a method for saving data
 
    * `SQLAlchemy <http://www.sqlalchemy.org/>`_, the most powerful OR-Mapper
-     for Python, and `Elixir <http://elixir.ematia.de/>`_, which makes
+     for Python, and `Elixir <https://pypi.python.org/pypi/Elixir>`_, which makes
      SQLAlchemy easier to use
 
    * `SQLObject <http://www.sqlobject.org/>`_, another popular OR-Mapper
 
    * `ZODB <https://launchpad.net/zodb>`_ and `Durus
-     <http://www.mems-exchange.org/software/durus/>`_, two object oriented
+     <https://www.mems-exchange.org/software/>`_, two object oriented
      databases
 
 
@@ -671,10 +671,10 @@
 example the ORM and template engine can be changed to use packages different
 from those used by default.
 
-The documentation can be found in the `TurboGears wiki
-<http://docs.turbogears.org/>`_, where links to screencasts can be found.
+The documentation can be found in the `TurboGears documentation
+<https://turbogears.readthedocs.org/>`_, where links to screencasts can be found.
 TurboGears has also an active user community which can respond to most related
-questions.  There is also a `TurboGears book <http://turbogearsbook.com/>`_
+questions.  There is also a `TurboGears book <http://turbogears.org/1.0/docs/TGBooks.html>`_
 published, which is a good starting point.
 
 The newest version of TurboGears, version 2.0, moves even further in direction