Connect with us

.htaccess File

How to Flush The Rewrite Rules or URL’s or permalinks in WordPress Dashboard?

WordPress will always flush the Rewrite URL’s or permalinks whenever you update your permalink structure. simply update your permalinks.

mm

Published

on

Permalinks URLs

Some of the time you may find that your blog pages are restoring a 404 error or mistake. On further examination, you discover that the homepage itself is working fine, and it is perfectly available.

Also, on the off chance that you attempt and visit your pages through the ID number, there are no issues. It’s just when you attempt and view them through the “pretty permalinks” that you encounter issues. If so, there’s no need to panic or freeze.

The issue is in all probability brought about by an out of date rewrite rules cache. Taking care of this issue can be simple or hard, relying upon how much access you have to your WordPress installation just as the backend.

We are looking at the three different ways to Flush the Rewrite Rules or URL’s or permalinks cache in WordPress – one is directly from the GUI of WordPress Dashboard, other straight from the WordPress MYSQL Database, and the last one as simple PHP Command or PHP function.

  • Flushing Rewrite Rules from the WordPress Dashboard
  • Deleting the Cache from the MYSQL Database
  • Flush Rewrite Cache via PHP

Before we know about what are the permalinks and structure of the permalinks in WordPress.

1. Permalinks: (Pretty Permalinks)

Permalinks are the URLs of web pages or posts. every article has different URL but permalinks are permanent which are valid for a long time. Permalinks are nothing but a structural format of the URLs.

Also Read : What is the Difference Between Absolute and Relative URLs?

2. Types of Permalinks:

There are three basic types of WordPress permalinks:

a) Ugly:

It is the default which looks like as http://example.com/?p=N

b) Pretty Permalinks:

Pretty Permalinks have a nice structure with different formats but most common looks like http://example.com/2018/post-name/ or http://example.com/2018/05/30/post-name

c) Almost Pretty:

It has a similar structure which looks like as http://example.com/index.php/2018/06/16/post-name/

3. Choosing your permalink structure in WordPress:

On WordPress site Dashboard » Settings » Permalinks screen, you can choose one of the permalink structure formats or enter your own in the “Custom structure formats” fields using the structure tags.

You can observe the below screenshot:

Permalink Settings

4. WordPress permalink structure Tags:

Structure tags are used to built Customize Permalink Structure Format of the WordPress blog or website. You can use one of the structure tags, or a combination of structure tags to built a Pretty or Almost Pretty Permalinks. See the examples below.

%post_id% or %postname% (e.g. /%year%/%monthnum%/%day%/%postname%/)

%year%
The year of the post, four digits, for example, 2018

%monthnum%
A Month of the year, for example, 06

%day%
Day of the month, for example, 16

%hour%
Hours of the day, for example, 16

%minute%
Minutes of the hour, for example, 34

%second%
Seconds of the minute, for example, 32

%post_id%
The unique ID # of the post, for example, 436

%postname%
A sanitized version of the title of the post/page to be used in the URL.

%category%
A sanitized version of the category name to be used in the URL.

%author%
A sanitized version of the author’s name to be used in the URL.

5. Category base and Tag base prefixes:

You can change the default values of the category and tag in the URL, but you can’t remove it from the URLs altogether. The Category and Tag base prefixes are used in URLs for category and tag archives, which look like as:

https://www.example.com/category_base/category_name
https://www.example.com/tag_base/tag_name

You can observe the below screenshot:

Permalinks Optional Settings

6. Flushing Rewrite Rules from the WordPress Dashboard

How to Flushing the Rewrite URL’s or permalinks from the WordPress Dashboard. WordPress can able to do everything for you automatically. WordPress will always flush the Rewrite URL’s or permalinks whenever you update your permalink structure. Simply update your permalinks when you make changes to your code. On the WordPress Dashboard » Settings » Permalinks you can update permalink structure.

7. Follow The Below Steps and observe the screenshot also

  • First, go to your WordPress site Dashboard » Settings » Permalinks.
  • Next, See the screenshot, go and click the “Save Changes” Bottom.
  • The Rewrite Rules and Permalinks are Flushed.

Flushing Rewrite Rules from the WordPress Dashboard

8. Default WordPress Apache Rewrite Rules or URL rewriting or .htaccess

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

If you have the access of your .htaccess file, WordPress will consequently flush the Rewrite cache. Any important improvements or changes, This is the easy and most clear approach to flush the rewrite rules cache. But in case it doesn’t work, we can achieve a similar effect directly by means of the MYSQL database.

9. Deleting the Rewrite Rules Cache from the MYSQL Database

You should be careful when doing this option. In a perfect world, you should take a backup of your whole database before rolling out any changes here. One wrong move could slaughter your whole WordPress installation. So be cautioned! Having said that, flushing the rewrite rules cache along these lines is very simple and just expects you to erase the value of a single field in the MYSQL database. Access your database either utilizing a third-party client or through phpMyAdmin by going through cPanel as shown the screenshot below:

phpMyAdmin on Cpanel

Select the phpMyAdmin in Cpanel and locate your website database in phpMyAdmin and hit the SQL tab is as shown in the screenshot below.

Type MYSQL Query in phpMyAdmin

Now type the following MYSQL query into the text box as per above screenshot:

SELECT * FROM `wp_options` WHERE `option_name` = ‘rewrite_rules’;

Hit the “Go” button on the bottom right side of the screen to execute the MYSQL command. This should return exactly one row. Click the “Edit” button as per the below screenshot.

rewrite rules cache row in mysql database

This will navigate up to the editable fields in this MYSQL row. In this row the one we are interested MYSQL Column is called “option_value” which contains a bunch of alphanumeric strings like as per below screenshot:

rewrite rules cache column in MySQL database

Select the “option_value” data as per the screenshot. Erase everything inside this field and save your changes. That is it – whenever you get to your WordPress site, it should automatically get modified. This is direct removal of the WordPress rewrite rules cache via the backend MYSQL database. In any case, you want a programmatic way to do it; we have that one also.

10. Flush Rewrite Rules Cache via PHP

One significant thing to remember is that this activity is a costly one regarding resources. You don’t need it running automatically every time you load WordPress. Subsequently, this order should be joined to a moderately uncommon event like say a plugin actuation or deactivation. The PHP function works that flushes the WordPress rewrite rules cache is:

flush_rewrite_rules();

As I said previously, it’s not a good idea to just add this as far as possible of your functions.php file since that would make it run almost persistently. Rather, either check for some previous condition before allowing it to execute or hook it into an action where it will be vital.

These three different ways of flushing your rewrite rules cache should give you enough choices for fixing your WordPress website in the case that you can’t get to the pages using the regular permalinks.

Helpful Resources:

1. 16 Best (free) AMP – (Accelerated Mobile Pages) WordPress Plugins

2. 16 Best Free SEO WordPress plugins for your Blogs & websites

3. What is an SEO Friendly URLs and Best Permalink Structure for WordPress?

4. 16 Most Important On-Page SEO Factors To Boost Your Ranking Faster in Google

5. The 4 Types of SEO That You Should Know

We are an Instructor, Modern Full Stack Web Application Developers, Freelancers, Tech Bloggers, and Technical SEO Experts. We deliver a rich set of software applications for your business needs.

Continue Reading
Click to comment

Leave a Reply

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

Entertainment2 weeks ago

13377x Original Site: 1337x Official Site, Proxy Sites, Movies, Torrents

Anime3 weeks ago

LimeTorrents Alternatives: Proxy Sites to Unblock LimeTorrents.cc

Anime3 weeks ago

Afdah Movies Alternatives – Watch Free HD Movies, TV Shows, Web Series

Entertainment3 weeks ago

Einthusan Alternatives & Competitors – Streaming Movies, and Live TV Shows

Workforce2 months ago

Best practices for ethical user activity monitoring

Digital Marketing3 months ago

How to Find a Great Paid Social Agency: Watch Out for These Pitfalls

AI Tools4 months ago

How to Learn New Technologies and Tools More Easily

Technology4 months ago

The Future of Tourism: Harnessing the Power of Technology

Games4 months ago

Parimatch starts cooperation with the AFA in Asia

Technology4 months ago

Outdoor Digital Signage through the Ages and its Influence

Trending