swordfish
swordfish

Reputation: 959

Nginx - How to full url redirect with pattern from old domain

I have a website that I've changed it zone last two days, there are some shared posts in all over the social networks, i want to redirect any user from the old domain to the new one, the problem is i get a full 301 Permanent Redirect to the main page not to that specific URL.

The redirect is handled by CloudFlare, in the roles page, I've created two forward roles as following:

https://myold.com/posts/* > https://mynew.org/posts/* < 302 Temporary Redirect

https://myold.com/* > https://mynew.org/* < 301 Permanent Redirect

Whats wrong here? do i have to use a different pattern? or i must do the redirect from Nginx server?

Upvotes: 1

Views: 151

Answers (1)

swordfish
swordfish

Reputation: 959

Hooray!! I got it to work, I just needed to match the pattern with the URL.

The main URL should look like this: *myold.com/* The new URL address must have a parameter to match what goes after *, so it should lool like this: https://mynew.org/$2

Now I get a full redirect to the same URL.

Upvotes: 1

Related Questions