Report this

What is the reason for this report?

Redirect any and all traffic to a folder to another url

Posted on December 20, 2017

Hi,

I am on Ubuntu 14.04.5 running Nginx 1.12.1.

I have a wordpress site, I would like to do the following:

Site A: example.com Site B: example.org

I would like to redirect any traffic to example.com/wp-content/* to example.org. This includes all subrectories and files (pdf, mp3, etc.)

If the url they are accessing is pointing to example.com/wp-content/folder1 or to example.com/wp-content/folder2/file.pdf, I want everything to be redirected to Site B.

I have tried the following, which redirects anyone accessing example.com/wp-content/ but not if they have the full url to a file:

location ^/(wp-content.) { rewrite ^/(wp-content.) example.org permanent; }

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.