Welcome! Log In Create A New Profile

Advanced

Redirect of permalinks in Wordpress.

October 28, 2017 09:49PM
Hi everyone!

I'm using NGINX with Worpdress on my site and would like to do some 301 redirects.

My site currently has permalinks: http://site.com/2017/10/29/post-example/ and would like to switch to http://site.com/post-example/

But I already have more than 120 articles published and ranked by Google and would not like to lose this ranking.

I would like to know how to redirect these links without having to do one by one.


I did a search and found a website that says that you need to enter the following lines:

location ~ "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$" {
rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$" http://site.com/$4 permanent;
}


My question is: Is this code correct? Where should I enter these lines?
I tried inserting into my nginx.conf file and then tried putting it in .htaccess. But I was not successful, because redirection is not being done after changing the permalinks.

If anyone can help me, I will be very grateful.
Subject Author Posted

Redirect of permalinks in Wordpress.

hpernaf October 28, 2017 09:49PM

Re: Redirect of permalinks in Wordpress.

JoakimR October 30, 2017 11:59PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 80
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready