I had once moved my blogger site to wordpress. Till then I had to use the following in .htaccess file.
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([^/]+).html$ http://mywpsite.com/$3
Now, after moving my site to Nginx, I could not find a way to implement the above rule so that my old permalinks are maintained in new environment also.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
The solution above worked partially.
Example:-
http://mywpsite.com/2011/08/one-of-my-post-link.html -> http://mywpsite.com/one-of-my-post-link/ (Success) http://www.mywpsite.com/2011/08/one-of-my-post-link.html -> http://www.anotherdomain.com/2011/08/one-of-my-post-link.html (failure)
The Nginx rewrite docs state:
So try,
Here it is: http://tny.cz/efcffa7f
I added the code inside the server block but getting error.
nginx: [emerg] directive “rewrite” is not terminated by “;” in /etc/nginx/sites-enabled/wordpress:67
Although, the semi-colon is placed in the code above.
You can use nginx’s
rewrite
directive to implement that: