diff --git a/docs/patterns/favicon.rst b/docs/patterns/favicon.rst index 6cf64ea0..edb2d0e5 100644 --- a/docs/patterns/favicon.rst +++ b/docs/patterns/favicon.rst @@ -17,7 +17,7 @@ tag in your HTML. So, for example: .. sourcecode:: html+jinja - + That's all you need for most browsers, however some really old ones do not support this standard. The old de-facto standard is to serve this file, @@ -26,8 +26,9 @@ the root path of the domain you either need to configure the webserver to serve the icon at the root or if you can't do that you're out of luck. If however your application is the root you can simply route a redirect:: - app.add_url_rule('/favicon.ico', - redirect_to=url_for('static', filename='favicon.ico')) + @app.route('/favicon.ico') + def favicon(): + return redirect(url_for('.static', filename='favicon.ico')) If you want to save the extra redirect request you can also write a view using :func:`~flask.send_from_directory`::