• 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 Leave a Comment

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. Hide and disable URL field in comment form in WordPress [ Plugin ]
  2. show post excerpt in atoms feed of octopress
  3. Print double hyphen sign simultaneously in post of Octopress
  4. error: The requested URL returned error: 403 Forbidden while accessing Github repo
  5. How to increase Password Expire date without resetting the password
  6. Learn Linux Date Command With Examples
  7. Use Linux Date Command As A Timezone Converter
  8. Linux command to find modified and access date of file/dir/filesystem
  9. How to find installation date and time of rpm package
  10. Find date of expiry and issue of SSL certificate with command

Filed Under: Linux Tagged With: nginx, wordpress

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Linux Commands

Install lxml by using pip command on Ubuntu 14.04 LTS

Force linux user to change password upon login

There are unfinished transactions remaining. You might consider running yum-complete-transaction

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

How to print particular line number by using sed command

Search keyword in all available man pages – man command

Temporarily change the shell after login

Explore 70+ Articles On Linux Commands

Always Useful Tips And Tricks

linux release renew dhcp assigned ip address

WordPress host IP changed not able to open wp-admin and site page looks scattered

Yum Error database disk image is malformed

How to configure htdigest in nagios server

How to create a file with cat command

How to zip directory in linux explained with examples

Replace keyword with its filename without extension : bash script

Explore 90+ Article On "Linux Tips And Tricks"

You Might Like These Articles!

Internal External Command

What is Linux/Unix Internal And External Command

Linux basic command

Linux Basic Commands For Every Beginner

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)

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission but Schools and Colleges can do in their Private Network
Proudly Blogging From Bharat.

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