Skip to content

Limitations on redirects for files

Redirects cannot be configured for any URLs that include /wp-content/uploads/*. The VIP File System, which resides upstream from application code, serves all files at that path. A reverse proxy is a possible solution for making a static asset available at a specific URL.

Note

In the case that a media file is stored on the VIP Files System, and a redirect is being considered in order to direct traffic to a newer version of that media file, the redirect can be avoided by overwriting and versioning the file instead.

By default, redirects and custom rewrite rules cannot be configured for any assets that match the regex \.(css|js|jp(e)?g|gif|png|swf|ico)$, regardless of the file’s URL. A 404 response will be returned by NGINX for requests to any file URIs that match that regex and do not exist within the VIP File System path (i.e. /wp-content/uploads/).

It is possible to request VIP Support to disable the default behavior for asset request URLs that match the regex but do not include /wp-content/uploads/*. If NGINX returns a 404 for qualifying requests, the request will be allowed to fall back on application code. Custom PHP logic can be added to application code that captures and redirects the request (301 moved permanently) to a different URL.

This alternative method can be useful capturing non-compatible paths for images post-migration, for example if migrating from a host where the site’s default directory structure for uploads was not /wp-content/uploads/.

Last updated: August 07, 2024

Relevant to

  • Node.js
  • WordPress