How do I redirect all requests for favicon.ico in root directory or any subdirectory to /images/favicon.ico

Accepted Answer

Try this rule:

RewriteEngine on
RewriteRule ^favicon\.ico$ /images/favicon.ico [L]

Edit    And for favicon.ico with arbitrary path segment depth:

RewriteCond $0 !=images/favicon.ico
RewriteRule ^([^/]+/)*favicon\.ico$ /images/favicon.ico [L]
Written by Gumbo
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki