Reputation: 873
I'm just moving my blog over to Ghost and all was ok except for around 50% of my blog posts are broken due to the date not being zero padded i.e.
old site format: http://www.example.com/blog/index.cfm/2013/8/9/my-slug
new site format: http://www.example.com/2013/08/09/my-slug
Removing the /blog/index.cfm was easy via
location /blog/index.cfm {
rewrite ^/blog/index.cfm(/.*)$ $1 last;
}
But cannot think of a way to zero pad dates (and there is around 700 posts).
Upvotes: 1
Views: 943
Reputation: 14344
Put several rewrites.
location /blog/index.cfm {
# 2013/1/1
rewrite ^/blog/index.cfm(/\d+)/(\d)/(\d)(/.*)?$ $1/0$2/0$3$4 last;
# 2013/1/11
rewrite ^/blog/index.cfm(/\d+)/(\d)/(\d\d)(/.*)?$ $1/0$2/$3$4 last;
# 2013/11/1
rewrite ^/blog/index.cfm(/\d+)/(\d\d)/(\d)(/.*)?$ $1/$2/0$3$4 last;
# all other
rewrite ^/blog/index.cfm(/.*)$ $1 last;
}
Upvotes: 3