How to redirect to specific url if contains specific text in url?

Question

I am new in WordPress and I am trying to create a plugin that redirects to the target by picking up the same post from source URL to target URL. The user just needs to enter the URL he wants to redirect. The plugin will auto put the post URL by picking up from the source post to target post

for e.g:
sc URL-

www.example.com/mypost/random-key-here

target url-

www.taga eturl.com/

plugin will auto add the post url and random key picking up from source url to target url like

www.targeturl.com/mypost/random-key-here

Please help me as i don’t know how to create the admin grid and how to get the data from admin grid into code.

for more explanation:
it can redirect if

www.example.com/mypost1/

to

www.example2.com/mypost1/

but it don’t redirect auto

www.example.com/mypost/slide1

to

**`www.example2.com/mypost/`**

we need to make it so that it can redirect by replacing the main source post url with target url and other things remain same
for e.g

www.example.com/mypost/slide1

replace the www.example.com/mypost/ with www.example2.com/mypost/ and other url auto add to target url (slide1).
I am using https://wordpress.org/plugins/redirection/ this plugin but want to add this functionality to this.

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/how-to-redirect-to-specific-url-if-contains-specific-text-in-url/">

How to redirect to specific url if contains specific text in url?</a>
0
Rakesh Kumar 3 months 0 Answers 42 views 0

Leave an answer