PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, September 1, 2022

[FIXED] How do i redirect a url/abc to url/abc/live-preview where abc is a variable name?

 September 01, 2022     nginx, nginx-config, nginx-location, nginx-reverse-proxy, redirect     No comments   

Issue

I have a url - https://sambit.com/hub/abc which i want to redirect to https://sambit.com/admin/sites/editors/hub-page/abc/live-preview where abc is a variable value . i wrote a nginx config like this - location /hub { rewrite ^/hub(.*)$ https://iwillonlytestit.replica.bangthetable.in/admin/sites/editors/hub-page/$1/live-preview permanent; } but it doesn't seems to redirect to the url i want . its redirecting to https://sambit.com/admin/sites/editors/hub-page/.*/live-preview. Can someone please help me out ?


Solution

I have found a way to achieve the task like follows -

rewrite ^(/hub)(.*)$   https://iwillonlytestit.replica.bangthetable.in/admin/sites/editors/hub-page$2/live-preview permanent;

this redirects from https://iwillonlytestit.replica.bangthetable.in/hub/abc to https://iwillonlytestit.replica.bangthetable.in/admin/sites/editors/hub-page/abc/live-preview



Answered By - sambit
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing