WordPress Category and Tag Base in Nginx


WordPress -> Settings -> Permalinks

Changing Category and Tag base in Apache2 web server is easy. Just click the button “Save changes”.

wordpress-category-tag-base

But, if you like to change wordpress category or tag in Nginx server, you need to use rewrite rules in your /etc/nginx/sites-available/example.com for category and tag base to work.

sudo nano /etc/nginx/sites-available/example.com

Add after server block:

rewrite ^/category/(.*)/$ /department/$1/ permanent;
rewrite ^/tag/(.*)/$ /subject/$1/ permanent;

Then simply restart the web-server to take effect the changes.

sudo service nginx restart

And you are done.

,

Leave a Reply

Your email address will not be published.