Title: Does redirection work with n8n?
Last modified: November 5, 2024

---

# Does redirection work with n8n?

 *  Resolved [mubiesam](https://wordpress.org/support/users/mubiesam/)
 * (@mubiesam)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/)
 * Created a redirection…
 * Source URL: /wp-json/custom/v1/precourse-redirect
 * Check Redirect >> 404 [https://see.architdz.tempurl.host/wp-json/custom/v1/precourse-redirect](https://see.architdz.tempurl.host/wp-json/custom/v1/precourse-redirect)
 * Cleared both Browser and Server cache, still 404
 * n8n HTTP Request
 * Method: GET
 * URL: [https://see.architdz.tempurl.host/wp-json/custom/v1/precourse-redirect](https://see.architdz.tempurl.host/wp-json/custom/v1/precourse-redirect)
 * Output: The resource you are requesting could not be found.
 * Any idea?
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdoes-redirection-work-with-n8n%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18115635)
 * What is n8n?
 * What redirect have you created?
 *  Thread Starter [mubiesam](https://wordpress.org/support/users/mubiesam/)
 * (@mubiesam)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18115683)
 * [https://n8n.io/](https://n8n.io/) is a workflow automation platform
 * Redirection created:
 * Source URL: /wp-json/custom/v1/precourse-redirect
 * Query Parameters: Exact match in any order
 * Match: URL only
 * When matched: Redirect to URL
 * Target URL: [https://see.architdz.tempurl.host/http-responses2wpn/](https://see.architdz.tempurl.host/http-responses2wpn/)
 *  Thread Starter [mubiesam](https://wordpress.org/support/users/mubiesam/)
 * (@mubiesam)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18116762)
 * FYR, I had added a Basic Redirect with the Redirection Plugin (No Custom Endpoint)
   
   Source URL: Set a URL pattern that doesn’t involve the REST API, such as /precourse-
   checkTested in browser, [https://see.architdz.tempurl.host/precourse-check](https://see.architdz.tempurl.host/precourse-check)
   it redirected toTarget URL: [https://see.architdz.tempurl.host/http-responses2wpn/](https://see.architdz.tempurl.host/http-responses2wpn/)
   correctly.
 * But tested with [https://see.architdz.tempurl.host/wp-json/custom/v1/precourse-redirect](https://see.architdz.tempurl.host/wp-json/custom/v1/precourse-redirect)
   got 404 error, so sounds REST API issue.
 * While tested with the default WordPress REST API endpoint by visiting [https://see.architdz.tempurl.host/wp-json/](https://see.architdz.tempurl.host/wp-json/),
   responded correctly without 404 error.
 * Really got confused, any idea?
   Thanks
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18117105)
 * It’s not possible to redirect a REST API route.
 *  Thread Starter [mubiesam](https://wordpress.org/support/users/mubiesam/)
 * (@mubiesam)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18117210)
 * Hi [@johnny5](https://wordpress.org/support/users/johnny5/)
 * Below is the answer from ChatGPT when I asked “Is it possible to redirect a REST
   API route?” Can you help me to clarify whether it is possible or just AI hallucination?
   Thank you!
 * Yes, it’s possible to redirect a REST API route, but it depends on how the redirection
   should be handled and the specific environment. Here are a few options:
    1. **Server-side Redirect**: In server-side applications, you can configure the
       API endpoint to respond with a `3xx` status code (like `301` for permanent redirection
       or `302` for temporary redirection) along with a `Location` header pointing 
       to the new URL. This will tell the client to make a request to the new route.
       Example in Express.js:javascript複製程式碼`app.get('/old-route', (req, res) 
       => { res.redirect(301, '/new-route'); });`
    2. **Client-side Handling**: If your API client can handle redirects, then you 
       could include the redirect logic directly in the client. You could use a `3xx`
       status response and a `Location` header, or return a JSON response with information
       on where to go next. This approach might be useful if you’re working with single-
       page applications or have restrictions on direct redirects.
    3. **Reverse Proxy**: If you’re using a reverse proxy like NGINX or a load balancer,
       you can configure it to redirect specific routes to new endpoints without modifying
       the application code. This is particularly useful if you want the redirection
       to happen transparently for clients.
    4. **Middleware Redirects**: For frameworks that support middleware (e.g., Express,
       Django), you can set up middleware that checks the requested route and redirects
       to the appropriate endpoint before it reaches the main handler.
 *  Plugin Author [John Godley](https://wordpress.org/support/users/johnny5/)
 * (@johnny5)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18117275)
 * That doesn’t seem relevant to WordPress or Redirection. I was just referring 
   to Redirection.
 *  Thread Starter [mubiesam](https://wordpress.org/support/users/mubiesam/)
 * (@mubiesam)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18117355)
 * Hi [@johnny5](https://wordpress.org/support/users/johnny5/)
 * If redirect a REST API route is not possible, any other method or suggestion 
   that can help to redirect from n8n as a external agent?
 * Thanks

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Does redirection work with n8n?’ is closed to new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [mubiesam](https://wordpress.org/support/users/mubiesam/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/does-redirection-work-with-n8n/#post-18117355)
 * Status: resolved