Problem with 301 redirect
October 05, 2014 11:45AM
Hi, I'm new here.
Trying to work on an nginx redirect
I'm using wordpress.
The goal is to change techraptor.net/%year%/%monthnum%/%day%/%postname%
(techraptor.net/2014/10/05/articlename) to

techraptor.net/content/%postname%

location ~ ^/[0-9]{4}/[0-9]{2}/[0-9]{2}/(.*)$
{
return 301 /$1 permanent;
}

This is what I have so far, but something isn't right. Nginx won't load it.

What am I doing wrong? I've tried this in a testing server block to avoid complications from other location blocks.



Edited 1 time(s). Last edit at 10/05/2014 11:45AM by Moscato.
Re: Problem with 301 redirect
October 05, 2014 12:31PM
I got it fixed.

location ~ ^/[0-9]+/[0-9]+/[0-9]+/(.*)
{
return 301 /content/$1;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 196
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready