• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to remove date from WordPress Post URL

June 18, 2020 by Sharad Chhetri

In this post we are sharing the steps to remove date from a WordPress post URL/permalink. We recently did this change in our own WordPress blog. It has been since long time we were using this date format in our blog permalink like this https://sharadchhetri.com/YYYY/MM/DD/post-slug . We decided to change the URL format in this way https://sharadchhetri.com/post-slug

To make this changes we have to work on Nginx Configuration and WordPress Admin console.

To change the WordPress Permalink, we will work on two areas which is our requirement.
1. Permalink settings change from WordPress Admin Console.
2. Updating Nginx configuration for redirection.

Do permalink settings change from WordPress Admin Console

To change the permalink settings we have to work on WordPress Admin Console. Login to WordPress Admin Dashboard. The login user should have admin privileges.

  • Login to your WordPress Blog Admin Dashboard. The login user should have Admin privileges.
  • Click on ‘Settings’ >> ‘Permalinks’
  • In “Permalink Settings” page, click on ‘Post name’ option.
    wordpress permalink
  • Click ‘Save Changes’

Using redirection in Nginx Configuration

Go for ‘redirection’ configuration in Nginx only when you want to redirect old permalink to new changed one.
We did this nginx configuration change only to keep our old blog URL to redirect to new URL. This will not affect our reader if they are coming from referrals. We have written the redirect in server block.

The redirect should be written inside the server or location block in Nginx configuration.

server {
   ....
    rewrite ^/([0-9]+)/([0-9]+)/([0-9]+)/(.*?)/?$  /$4 permanent;
   ....
}

Save the Nginx configuration.
Before restarting the nginx service, confirm first if configuration is correct. To check the Nginx configuration run the command sudo nginx -t. Restart the nginx service once the sudo nginx -t is OK.
nginx

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. show post excerpt in atoms feed of octopress
  2. Print double hyphen sign simultaneously in post of Octopress
  3. Hide and disable URL field in comment form in WordPress [ Plugin ]
  4. error: The requested URL returned error: 403 Forbidden while accessing Github repo
  5. How to setup Varnish to do not cache particular url specific domain
  6. How to setup varnish to do not cache particular url
  7. Learn Linux Date Command With Examples
  8. Use Linux Date Command As A Timezone Converter
  9. Linux command to find modified and access date of file/dir/filesystem
  10. How to find installation date and time of rpm package

Filed Under: Linux Tagged With: nginx, wordpress

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How to install korn shell ksh in Linux

curl command to check the http status

Agent admitted failure to sign using the key ssh

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

How to find when Operating system was installed in linux CentOS and Red Hat

Edit the crontab without using crontab -e

set and unset line number in file with vi editor

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy